diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-07-30 10:07:06 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-08-02 13:47:39 -0400 |
commit | 30a249aac87be4701bfafae2ed3c5a6e964aa3fc (patch) | |
tree | acc6228b46fb22e7b10c55ad2477cb84d03e3e83 | |
parent | b8cb29e53ee6d3a2fda8a342de72e3fefec7d547 (diff) | |
download | python-coveragepy-git-30a249aac87be4701bfafae2ed3c5a6e964aa3fc.tar.gz |
test: xfail some tests that need PyPy to improve #1426
https://foss.heptapod.net/pypy/pypy/-/issues/3792
-rw-r--r-- | coverage/env.py | 2 | ||||
-rw-r--r-- | tests/helpers.py | 7 | ||||
-rw-r--r-- | tests/test_process.py | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/coverage/env.py b/coverage/env.py index 2e21b9a7..13411699 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -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. diff --git a/tests/helpers.py b/tests/helpers.py index 32115dc1..f593c72c 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -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", ) diff --git a/tests/test_process.py b/tests/test_process.py index c473cf9a..fcbcb9ba 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -19,7 +19,7 @@ from coverage.data import line_counts 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): @@ -283,6 +283,7 @@ class ProcessTest(CoverageTest): 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): @@ -302,7 +303,7 @@ class ProcessTest(CoverageTest): 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 @@ -695,6 +696,7 @@ class EnvironmentTest(CoverageTest): 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()) |