Skip to content

Commit d4c09f9

Browse files
committed
test: xfail decorator tests that fail on PyPy 3.8 (7.3.10alpha)
https://foss.heptapod.net/pypy/pypy/-/issues/3749
1 parent 50e518e commit d4c09f9

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

tests/helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
from unittest import mock
1717

18+
import pytest
19+
20+
from coverage import env
1821
from coverage.exceptions import CoverageWarning
1922
from coverage.misc import output_encoding
2023

@@ -313,3 +316,9 @@ def swallow_warnings(message=r".", category=CoverageWarning):
313316
with warnings.catch_warnings():
314317
warnings.filterwarnings("ignore", category=category, message=message)
315318
yield
319+
320+
321+
xfail_pypy_3749 = pytest.mark.xfail(
322+
env.PYVERSION[:2] == (3, 8) and env.PYPY and env.PYPYVERSION >= (7, 3, 10),
323+
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749"
324+
)

tests/test_arcs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
from tests.coveragetest import CoverageTest
9-
from tests.helpers import assert_count_equal
9+
from tests.helpers import assert_count_equal, xfail_pypy_3749
1010

1111
import coverage
1212
from coverage import env
@@ -1647,6 +1647,7 @@ def f(a, b):
16471647
class DecoratorArcTest(CoverageTest):
16481648
"""Tests of arcs with decorators."""
16491649

1650+
@xfail_pypy_3749
16501651
def test_function_decorator(self):
16511652
arcz = (
16521653
".1 16 67 7A AE EF F. " # main line
@@ -1675,6 +1676,7 @@ def my_function(
16751676
arcz=arcz,
16761677
)
16771678

1679+
@xfail_pypy_3749
16781680
def test_class_decorator(self):
16791681
arcz = (
16801682
".1 16 67 6D 7A AE E. " # main line
@@ -1702,6 +1704,7 @@ class MyObject(
17021704
arcz=arcz,
17031705
)
17041706

1707+
@xfail_pypy_3749
17051708
def test_bug_466a(self):
17061709
# A bad interaction between decorators and multi-line list assignments,
17071710
# believe it or not...!
@@ -1726,6 +1729,7 @@ def parse(cls):
17261729
arcz=arcz,
17271730
)
17281731

1732+
@xfail_pypy_3749
17291733
def test_bug_466b(self):
17301734
# A bad interaction between decorators and multi-line list assignments,
17311735
# believe it or not...!
@@ -1919,6 +1923,7 @@ async def go():
19191923
arcz_missing=arcz_missing,
19201924
)
19211925

1926+
@xfail_pypy_3749
19221927
def test_async_decorator(self):
19231928
arcz = ".1 14 4. .2 2. -46 6-4 "
19241929
if env.PYBEHAVIOR.trace_decorated_def:

tests/test_coverage.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from coverage.exceptions import NoDataError
1111

1212
from tests.coveragetest import CoverageTest
13+
from tests.helpers import xfail_pypy_3749
1314

1415

1516
class TestCoverageTest(CoverageTest):
@@ -1617,6 +1618,7 @@ def test_excluded_comprehension_branches(self):
16171618
class Py24Test(CoverageTest):
16181619
"""Tests of new syntax in Python 2.4."""
16191620

1621+
@xfail_pypy_3749
16201622
def test_function_decorators(self):
16211623
lines = [1, 2, 3, 4, 6, 8, 10, 12]
16221624
if env.PYBEHAVIOR.trace_decorated_def:
@@ -1637,6 +1639,7 @@ def p1(arg):
16371639
""",
16381640
lines, "")
16391641

1642+
@xfail_pypy_3749
16401643
def test_function_decorators_with_args(self):
16411644
lines = [1, 2, 3, 4, 5, 6, 8, 10, 12]
16421645
if env.PYBEHAVIOR.trace_decorated_def:
@@ -1657,6 +1660,7 @@ def boosted(arg):
16571660
""",
16581661
lines, "")
16591662

1663+
@xfail_pypy_3749
16601664
def test_double_function_decorators(self):
16611665
lines = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 17, 19, 21, 22, 24, 26]
16621666
if env.PYBEHAVIOR.trace_decorated_def:

tests/test_parser.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from coverage.parser import ast_dump, ast_parse, PythonParser
1515

1616
from tests.coveragetest import CoverageTest, TESTS_DIR
17-
from tests.helpers import arcz_to_arcs, re_lines
17+
from tests.helpers import arcz_to_arcs, re_lines, xfail_pypy_3749
1818

1919

2020
class PythonParserTest(CoverageTest):
@@ -139,10 +139,7 @@ def test_token_error(self):
139139
'''
140140
""")
141141

142-
@pytest.mark.xfail(
143-
env.PYPY and env.PYPYVERSION == (7, 3, 0),
144-
reason="https://bitbucket.org/pypy/pypy/issues/3139",
145-
)
142+
@xfail_pypy_3749
146143
def test_decorator_pragmas(self):
147144
parser = self.parse_source("""\
148145
# 1
@@ -178,6 +175,7 @@ def func(x=25):
178175
assert parser.raw_statements == raw_statements
179176
assert parser.statements == {8}
180177

178+
@xfail_pypy_3749
181179
def test_decorator_pragmas_with_colons(self):
182180
# A colon in a decorator expression would confuse the parser,
183181
# ending the exclusion of the decorated function.
@@ -212,6 +210,7 @@ def __init__(self):
212210
assert parser.raw_statements == {1, 2, 3, 5, 6, 7, 8}
213211
assert parser.statements == {1, 2, 3}
214212

213+
@xfail_pypy_3749
215214
def test_empty_decorated_function(self):
216215
parser = self.parse_source("""\
217216
def decorator(func):

0 commit comments

Comments
 (0)