summaryrefslogtreecommitdiff
path: root/tests/test_coverage.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-03 17:12:30 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-11-03 17:12:30 -0400
commitd8f1d925dc0aa4908f3f5a1b965f671bcf1b5ba6 (patch)
tree1d6dfbe477acc9a2d7cac5190875a671071ec8ea /tests/test_coverage.py
parentd469f30b3126159a7a6693703203556d124a3dea (diff)
downloadpython-coveragepy-git-d8f1d925dc0aa4908f3f5a1b965f671bcf1b5ba6.tar.gz
Adapt to 3.8's way of tracing decorated functions
Diffstat (limited to 'tests/test_coverage.py')
-rw-r--r--tests/test_coverage.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 676fc831..60205900 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -1579,6 +1579,9 @@ class Py24Test(CoverageTest):
"""Tests of new syntax in Python 2.4."""
def test_function_decorators(self):
+ lines = [1, 2, 3, 4, 6, 8, 10, 12]
+ if env.PYBEHAVIOR.trace_decorated_def:
+ lines = sorted(lines + [9])
self.check_coverage("""\
def require_int(func):
def wrapper(arg):
@@ -1593,9 +1596,12 @@ class Py24Test(CoverageTest):
assert p1(10) == 20
""",
- [1,2,3,4,6,8,10,12], "")
+ lines, "")
def test_function_decorators_with_args(self):
+ lines = [1, 2, 3, 4, 5, 6, 8, 10, 12]
+ if env.PYBEHAVIOR.trace_decorated_def:
+ lines = sorted(lines + [9])
self.check_coverage("""\
def boost_by(extra):
def decorator(func):
@@ -1610,9 +1616,12 @@ class Py24Test(CoverageTest):
assert boosted(10) == 200
""",
- [1,2,3,4,5,6,8,10,12], "")
+ lines, "")
def test_double_function_decorators(self):
+ lines = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 17, 19, 21, 22, 24, 26]
+ if env.PYBEHAVIOR.trace_decorated_def:
+ lines = sorted(lines + [16, 23])
self.check_coverage("""\
def require_int(func):
def wrapper(arg):
@@ -1641,8 +1650,7 @@ class Py24Test(CoverageTest):
assert boosted2(10) == 200
""",
- ([1,2,3,4,5,7,8,9,10,11,12,14,15,17,19,21,22,24,26],
- [1,2,3,4,5,7,8,9,10,11,12,14, 17,19,21, 24,26]), "")
+ lines, "")
class Py25Test(CoverageTest):