Skip to content

Commit 9d90ebd

Browse files
committed
fix: pypy3.9 traces decorators like CPython 3.8
1 parent c778139 commit 9d90ebd

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ development at the same time, such as 4.5.x and 5.0.
2020
Unreleased
2121
----------
2222

23+
- Fix: adapt to pypy3.9's decorator tracing behavior. It now traces function
24+
decorators like CPython 3.8: both the @-line and the def-line are traced.
25+
Fixes `issue 1326`_.
26+
2327
- Debug: added ``pybehave`` to the list of :ref:`cmd_debug` and
2428
:ref:`cmd_run_debug` options.
2529

2630
- Fix: show an intelligible error message if ``--concurrency=multiprocessing``
2731
is used without a configuration file. Closes `issue 1320`_.
2832

2933
.. _issue 1320: https://github.com/nedbat/coveragepy/issues/1320
34+
.. _issue 1326: https://github.com/nedbat/coveragepy/issues/1326
3035

3136

3237
.. _changes_631:

coverage/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PYBEHAVIOR:
7171
# When a function is decorated, does the trace function get called for the
7272
# @-line and also the def-line (new behavior in 3.8)? Or just the @-line
7373
# (old behavior)?
74-
trace_decorated_def = (CPYTHON and PYVERSION >= (3, 8))
74+
trace_decorated_def = (CPYTHON and PYVERSION >= (3, 8)) or (PYPY and PYVERSION >= (3, 9))
7575

7676
# Functions are no longer claimed to start at their earliest decorator even though
7777
# the decorators are traced?

tests/test_arcs.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -926,11 +926,6 @@ def test_finally_in_loop_bug_92(self):
926926
arcz=".1 12 23 35 56 61 17 7.",
927927
)
928928

929-
@pytest.mark.xfail(
930-
env.PYPY and env.PYVERSION >= (3, 9),
931-
reason="avoid a PyPy bug: 3662"
932-
# https://foss.heptapod.net/pypy/pypy/-/issues/3662
933-
)
934929
def test_bug_212(self):
935930
# "except Exception as e" is crucial here.
936931
# Bug 212 said that the "if exc" line was incorrectly marked as only
@@ -1653,11 +1648,6 @@ def f(a, b):
16531648
class DecoratorArcTest(CoverageTest):
16541649
"""Tests of arcs with decorators."""
16551650

1656-
@pytest.mark.xfail(
1657-
env.PYPY and env.PYVERSION >= (3, 9),
1658-
reason="avoid a PyPy bug: 3666"
1659-
# https://foss.heptapod.net/pypy/pypy/-/issues/3666
1660-
)
16611651
def test_function_decorator(self):
16621652
arcz = (
16631653
".1 16 67 7A AE EF F. " # main line
@@ -1686,11 +1676,6 @@ def my_function(
16861676
arcz=arcz,
16871677
)
16881678

1689-
@pytest.mark.xfail(
1690-
env.PYPY and env.PYVERSION >= (3, 9),
1691-
reason="avoid a PyPy bug: 3666"
1692-
# https://foss.heptapod.net/pypy/pypy/-/issues/3666
1693-
)
16941679
def test_class_decorator(self):
16951680
arcz = (
16961681
".1 16 67 6D 7A AE E. " # main line

tests/test_coverage.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,11 +1218,6 @@ def foo(
12181218
reason="avoid class docstring bug: bpo 46331",
12191219
# https://bugs.python.org/issue46331
12201220
)
1221-
@pytest.mark.xfail(
1222-
env.PYPY and env.PYVERSION[:2] == (3, 9),
1223-
reason="avoid PyPy class docstring bug: 3665",
1224-
# https://foss.heptapod.net/pypy/pypy/-/issues/3665
1225-
)
12261221
def test_class_def(self):
12271222
arcz="-22 2D DE E-2 23 36 6A A-2 -68 8-6 -AB B-A"
12281223
self.check_coverage("""\

0 commit comments

Comments
 (0)