Skip to content

Commit

Permalink
test: xfail some tests that need PyPy to improve #1426
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Aug 2, 2022
1 parent b8cb29e commit 30a249a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion coverage/env.py
Expand Up @@ -85,7 +85,7 @@ class PYBEHAVIOR:
nix_while_true = (PYVERSION >= (3, 8))

# CPython 3.9a1 made sys.argv[0] and other reported files absolute paths.
report_absolute_files = (CPYTHON and PYVERSION >= (3, 9))
report_absolute_files = ((CPYTHON or (PYPYVERSION >= (7, 3, 10))) and PYVERSION >= (3, 9))

# Lines after break/continue/return/raise are no longer compiled into the
# bytecode. They used to be marked as missing, now they aren't executable.
Expand Down
7 changes: 6 additions & 1 deletion tests/helpers.py
Expand Up @@ -320,5 +320,10 @@ def swallow_warnings(message=r".", category=CoverageWarning):

xfail_pypy_3749 = pytest.mark.xfail(
env.PYVERSION[:2] == (3, 8) and env.PYPY and env.PYPYVERSION >= (7, 3, 10),
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749"
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749",
)

xfail_pypy_3792 = pytest.mark.xfail(
env.PYBEHAVIOR.report_absolute_files and env.PYPY,
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3792",
)
6 changes: 4 additions & 2 deletions tests/test_process.py
Expand Up @@ -19,7 +19,7 @@
from coverage.files import abs_file, python_reported_file

from tests.coveragetest import CoverageTest, TESTS_DIR
from tests.helpers import re_lines_text
from tests.helpers import re_lines_text, xfail_pypy_3792


class ProcessTest(CoverageTest):
Expand Down Expand Up @@ -283,6 +283,7 @@ def test_running_missing_file(self):
assert "rror" not in out
assert status == 1

@xfail_pypy_3792 # Because the file names aren't yet absolute.
def test_code_throws(self):
self.make_file("throw.py", """\
class MyException(Exception):
Expand All @@ -302,7 +303,7 @@ def f2():
status, out = self.run_command_status("coverage run throw.py")
out2 = self.run_command("python throw.py")
if env.PYPY:
# Pypy has an extra frame in the traceback for some reason
# PyPy has an extra frame in the traceback for some reason
out2 = re_lines_text("toplevel", out2, match=False)
assert out == out2

Expand Down Expand Up @@ -695,6 +696,7 @@ def test_coverage_run_dashm_is_like_python_dashm(self):
actual = self.run_command("coverage run -m process_test.try_execfile")
self.assert_tryexecfile_output(expected, actual)

@xfail_pypy_3792 # Because the sys.path[0] isn't yet absolute.
def test_coverage_run_dir_is_like_python_dir(self):
with open(TRY_EXECFILE) as f:
self.make_file("with_main/__main__.py", f.read())
Expand Down

0 comments on commit 30a249a

Please sign in to comment.