summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-08-09 16:36:14 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-08-09 16:56:38 -0400
commit6c8ccb13e0dc78bed148fb0c1626e93429704a30 (patch)
treeeac3cd95c4932c7a83dbe7652e2fd52a9db65048
parentf5621baca33e193f03286acf998a92ac67f3b723 (diff)
downloadpython-coveragepy-git-6c8ccb13e0dc78bed148fb0c1626e93429704a30.tar.gz
test: a part-covered comprehension
The comprehension would only completely finish (->exit) if the assert was going to fail. So we expect it to not finish.
-rw-r--r--metacov.ini1
-rw-r--r--tests/test_execfile.py4
-rw-r--r--tests/test_plugins.py3
3 files changed, 3 insertions, 5 deletions
diff --git a/metacov.ini b/metacov.ini
index 209c1212..fa6887e2 100644
--- a/metacov.ini
+++ b/metacov.ini
@@ -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:
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index fe02f5fe..c0ed2d48 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -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
@@ -107,7 +105,7 @@ class RunFileTest(CoverageTest):
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")
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 18c08507..ecc464cc 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -657,7 +657,8 @@ class BadFileTracerTest(FileTracerTest):
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", """\