Skip to content

Commit 30a249a

Browse files
committed
test: xfail some tests that need PyPy to improve #1426
https://foss.heptapod.net/pypy/pypy/-/issues/3792
1 parent b8cb29e commit 30a249a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

coverage/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class PYBEHAVIOR:
8585
nix_while_true = (PYVERSION >= (3, 8))
8686

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

9090
# Lines after break/continue/return/raise are no longer compiled into the
9191
# bytecode. They used to be marked as missing, now they aren't executable.

tests/helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,5 +320,10 @@ def swallow_warnings(message=r".", category=CoverageWarning):
320320

321321
xfail_pypy_3749 = pytest.mark.xfail(
322322
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"
323+
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749",
324+
)
325+
326+
xfail_pypy_3792 = pytest.mark.xfail(
327+
env.PYBEHAVIOR.report_absolute_files and env.PYPY,
328+
reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3792",
324329
)

tests/test_process.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from coverage.files import abs_file, python_reported_file
2020

2121
from tests.coveragetest import CoverageTest, TESTS_DIR
22-
from tests.helpers import re_lines_text
22+
from tests.helpers import re_lines_text, xfail_pypy_3792
2323

2424

2525
class ProcessTest(CoverageTest):
@@ -283,6 +283,7 @@ def test_running_missing_file(self):
283283
assert "rror" not in out
284284
assert status == 1
285285

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

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

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

0 commit comments

Comments
 (0)