Skip to content

Commit

Permalink
test: a part-covered comprehension
Browse files Browse the repository at this point in the history
The comprehension would only completely finish (->exit) if the assert
was going to fail.  So we expect it to not finish.
  • Loading branch information
nedbat committed Aug 9, 2021
1 parent f5621ba commit 6c8ccb1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion metacov.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ partial_branches =
pragma: part covered
# A for-loop that always hits its break statement
pragma: always breaks
pragma: if failure
pragma: part started
if env.TESTING:
if env.METACOV:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_execfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
"""Tests for coverage.execfile"""

import compileall
import fnmatch
import json
import os
import os.path
import pathlib
import re
import sys

import pytest

Expand Down Expand Up @@ -107,7 +105,7 @@ def test_directory_without_main(self):
class RunPycFileTest(CoverageTest):
"""Test cases for `run_python_file`."""

def make_pyc(self): # pylint: disable=inconsistent-return-statements
def make_pyc(self):
"""Create a .pyc file, and return the path to it."""
if env.JYTHON:
pytest.skip("Can't make .pyc files on Jython")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None,
if excmsg:
assert excmsg in stderr
if excmsgs:
assert any(em in stderr for em in excmsgs), f"expected one of {excmsgs} in stderr"
found_exc = any(em in stderr for em in excmsgs) # pragma: part covered
assert found_exc, f"expected one of {excmsgs} in stderr"

def test_file_tracer_has_no_file_tracer_method(self):
self.make_file("bad_plugin.py", """\
Expand Down

0 comments on commit 6c8ccb1

Please sign in to comment.