Skip to content

Commit

Permalink
fix: changes for PyPy3.8
Browse files Browse the repository at this point in the history
- 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
  (pypa/virtualenv#2182), so use venv instead for our
  virtualenv tests.
  • Loading branch information
nedbat committed Oct 21, 2021
1 parent 4e8d690 commit a5c6d00
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions coverage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class PYBEHAVIOR:
# block, does the finally block do the break/continue/return (pre-3.8), or
# does the finally jump back to the break/continue/return (3.8) to do the
# work?
finally_jumps_back = ((3, 8) <= PYVERSION < (3, 10))
finally_jumps_back = (CPYTHON and ((3, 8) <= PYVERSION < (3, 10)))

# 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))
Expand Down
1 change: 1 addition & 0 deletions tests/test_oddball.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", """\
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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,
Expand Down

0 comments on commit a5c6d00

Please sign in to comment.