Skip to content

Commit

Permalink
build: adjust pybehave for pypy 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 12, 2023
1 parent 6c36639 commit 5ae4982
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 2 additions & 5 deletions coverage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ class PYBEHAVIOR:

# Does Python conform to PEP626, Precise line numbers for debugging and other tools.
# https://www.python.org/dev/peps/pep-0626
pep626 = CPYTHON and (PYVERSION > (3, 10, 0, "alpha", 4))
pep626 = (PYVERSION > (3, 10, 0, "alpha", 4))

# Is "if __debug__" optimized away?
if PYPY:
optimize_if_debug = True
else:
optimize_if_debug = not pep626
optimize_if_debug = not pep626

# Is "if not __debug__" optimized away? The exact details have changed
# across versions.
Expand Down
7 changes: 7 additions & 0 deletions tests/test_arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
reason="https://foss.heptapod.net/pypy/pypy/-/issues/3882",
)

xfail_pypy_3936 = pytest.mark.xfail(
env.PYPY and env.PYVERSION[:2] >= (3, 10),
reason="https://foss.heptapod.net/pypy/pypy/-/issues/3936",
)

class SimpleArcTest(CoverageTest):
"""Tests for coverage.py's arc measurement."""
Expand Down Expand Up @@ -1325,6 +1329,7 @@ def gen():
@pytest.mark.skipif(not env.PYBEHAVIOR.match_case, reason="Match-case is new in 3.10")
class MatchCaseTest(CoverageTest):
"""Tests of match-case."""
@xfail_pypy_3936
def test_match_case_with_default(self) -> None:
self.check_coverage("""\
for command in ["huh", "go home", "go n"]:
Expand All @@ -1341,6 +1346,7 @@ def test_match_case_with_default(self) -> None:
)
assert self.stdout() == "default\nno go\ngo: n\n"

@xfail_pypy_3936
def test_match_case_with_wildcard(self) -> None:
self.check_coverage("""\
for command in ["huh", "go home", "go n"]:
Expand All @@ -1357,6 +1363,7 @@ def test_match_case_with_wildcard(self) -> None:
)
assert self.stdout() == "default: ['huh']\nno go\ngo: n\n"

@xfail_pypy_3936
def test_match_case_without_wildcard(self) -> None:
self.check_coverage("""\
match = None
Expand Down

0 comments on commit 5ae4982

Please sign in to comment.