summaryrefslogtreecommitdiff
path: root/tests/test_coverage.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-01-02 10:38:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-01-10 09:46:18 -0500
commite3f8053d805f8930ffc8424ac098576457c5f506 (patch)
treee34badb9cdbe80b7f9360efd8fe75f266ea04708 /tests/test_coverage.py
parent3adae9b5cdf67f7364607e3ca7307fa6ebbe1b08 (diff)
downloadpython-coveragepy-git-e3f8053d805f8930ffc8424ac098576457c5f506.tar.gz
PEP 626: constant tests are kept as no-ops
The conditionals are now getting unwieldy, perhaps we can simplify them in the future?
Diffstat (limited to 'tests/test_coverage.py')
-rw-r--r--tests/test_coverage.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index b56d3b59..a6c8f492 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -8,7 +8,7 @@ import coverage
from coverage import env
from coverage.misc import CoverageException
-from tests.coveragetest import CoverageTest
+from tests.coveragetest import CoverageTest, xfail
class TestCoverageTest(CoverageTest):
@@ -622,7 +622,9 @@ class SimpleStatementTest(CoverageTest):
b = 3
assert (a,b) == (1,3)
""",
- [1,3,4], "")
+ ([1,3,4], [1,2,3,4]),
+ "",
+ )
self.check_coverage("""\
a = 1
"An extra docstring, should be a comment."
@@ -632,7 +634,9 @@ class SimpleStatementTest(CoverageTest):
c = 6
assert (a,b,c) == (1,3,6)
""",
- ([1,3,6,7], [1,3,5,6,7], [1,3,4,5,6,7]), "")
+ ([1,3,6,7], [1,3,5,6,7], [1,3,4,5,6,7], [1,2,3,4,5,6,7]),
+ "",
+ )
def test_nonascii(self):
self.check_coverage("""\
@@ -675,6 +679,7 @@ class CompoundStatementTest(CoverageTest):
""",
[1,2,3,5], "")
+ @xfail(env.PYBEHAVIOR.pep626, reason="pep626: https://bugs.python.org/issue42810")
def test_if(self):
self.check_coverage("""\
a = 1
@@ -926,12 +931,18 @@ class CompoundStatementTest(CoverageTest):
[1,2,4,5,7,9,10], "4, 7")
def test_constant_if(self):
+ if env.PYBEHAVIOR.keep_constant_test:
+ lines = [1, 2, 3]
+ else:
+ lines = [2, 3]
self.check_coverage("""\
if 1:
a = 2
assert a == 2
""",
- [2,3], "")
+ lines,
+ "",
+ )
def test_while(self):
self.check_coverage("""\