diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-21 08:46:15 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-25 19:01:10 -0400 |
commit | fbb3533295cfcefc6574fb2186d4e8f4e2a20dd3 (patch) | |
tree | 0f95bb46f17a95afc685b785f58c763ea3f2a13f | |
parent | 7de7a340afad244b010f8d4ca81868e65f9f156f (diff) | |
download | python-coveragepy-git-fbb3533295cfcefc6574fb2186d4e8f4e2a20dd3.tar.gz |
fix: changes for PyPy3.8
- Update tox.ini to let us run against PyPy3.8
- Some 3.8 behavior is (apparently) only on CPython
- PyPy3.8 doesn't get along with virtualenv yet
(https://github.com/pypa/virtualenv/issues/2182), so use venv instead for our
virtualenv tests.
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | coverage/env.py | 5 | ||||
-rw-r--r-- | doc/index.rst | 2 | ||||
-rw-r--r-- | tests/test_arcs.py | 2 | ||||
-rw-r--r-- | tests/test_oddball.py | 1 | ||||
-rw-r--r-- | tests/test_process.py | 2 | ||||
-rw-r--r-- | tox.ini | 2 |
8 files changed, 13 insertions, 5 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index d7149f17..f7636e78 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,6 +30,8 @@ Unreleased - Feature: The HTML report pages for Python source files now have a sticky header so the file name and controls are always visible. +- Added support for PyPy 3.8. + - Fix: more generated code is now excluded from measurement. Code such as `attrs`_ boilerplate, or doctest code, was being measured though the synthetic line numbers meant they were never reported. Once Cython was @@ -20,7 +20,7 @@ library to determine which lines are executable, and which have been executed. Coverage.py runs on these versions of Python: * CPython 3.6 through 3.10. -* PyPy3 7.3.3. +* PyPy3 7.3.7. Documentation is on `Read the Docs`_. Code repository and issue tracker are on `GitHub`_. diff --git a/coverage/env.py b/coverage/env.py index c300f802..68da83dd 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -50,6 +50,9 @@ class PYBEHAVIOR: if pep626: optimize_if_not_debug2 = False + # Yet another way to optimize "if not __debug__"? + optimize_if_not_debug3 = (PYPY and PYVERSION >= (3, 8)) + # Can co_lnotab have negative deltas? negative_lnotab = not (PYPY and PYPYVERSION < (7, 2)) @@ -77,7 +80,7 @@ class PYBEHAVIOR: # When a function is decorated, does the trace function get called for the # @-line and also the def-line (new behavior in 3.8)? Or just the @-line # (old behavior)? - trace_decorated_def = (PYVERSION >= (3, 8)) + trace_decorated_def = (CPYTHON and PYVERSION >= (3, 8)) # Are while-true loops optimized into absolute jumps with no loop setup? nix_while_true = (PYVERSION >= (3, 8)) diff --git a/doc/index.rst b/doc/index.rst index b2ceed73..7d7e1d7b 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -18,7 +18,7 @@ supported on: * Python versions 3.6 through 3.10. -* PyPy3 7.3.3. +* PyPy3 7.3.7. .. ifconfig:: prerelease diff --git a/tests/test_arcs.py b/tests/test_arcs.py index f4a11839..6a65d4fe 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -1530,6 +1530,8 @@ class OptimizedIfTest(CoverageTest): arcz_missing = "" if env.PYBEHAVIOR.pep626: arcz = ".1 12 23 34 42 37 72 28 8." + elif env.PYBEHAVIOR.optimize_if_not_debug3: + arcz = ".1 12 23 32 37 72 28 8." elif env.PYBEHAVIOR.optimize_if_not_debug2: arcz = ".1 12 23 35 52 37 72 28 8." elif env.PYBEHAVIOR.optimize_if_not_debug: diff --git a/tests/test_oddball.py b/tests/test_oddball.py index b59e6395..19c93be5 100644 --- a/tests/test_oddball.py +++ b/tests/test_oddball.py @@ -148,6 +148,7 @@ class MemoryLeakTest(CoverageTest): """ @flaky @pytest.mark.skipif(env.JYTHON, reason="Don't bother on Jython") + @pytest.mark.skipif(not env.C_TRACER, reason="Only the C tracer has refcounting issues") def test_for_leaks(self): # Our original bad memory leak only happened on line numbers > 255, so # make a code object with more lines than that. Ugly string mumbo diff --git a/tests/test_process.py b/tests/test_process.py index bf16a2b2..10312232 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1691,7 +1691,7 @@ def venv_world_fixture(tmp_path_factory): venv_world = tmp_path_factory.mktemp("venv_world") with change_dir(venv_world): # Create a virtualenv. - run_command("python -m virtualenv venv") + run_command("python -m venv venv") # A third-party package that installs a few different packages. make_file("third_pkg/third/__init__.py", """\ @@ -26,7 +26,7 @@ install_command = python -m pip install -U {opts} {packages} passenv = * setenv = - pypy,pypy3: COVERAGE_NO_CTRACER=no C extension under PyPy + pypy{3,37,38}: COVERAGE_NO_CTRACER=no C extension under PyPy jython: COVERAGE_NO_CTRACER=no C extension under Jython jython: PYTEST_ADDOPTS=-n 0 # For some tests, we need .pyc files written in the current directory, |