summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-10 07:39:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-10 14:49:15 -0500
commit59e29586615fe6445b9f5ab418f9635d7d754259 (patch)
treed73362ab9ad9e7c791765fdbbc1bad36864bc13c
parentdfa97742b62f83b5c892e5de78a3ef1a97ee8a27 (diff)
downloadpython-coveragepy-git-nedbat/py3.11.tar.gz
fix: make this work on CPython 3.11 #1241nedbat/py3.11
The fix for CTracer is egregious and will need to be updated when there's a supported way to do it. The fullcoverage skip is noted in https://github.com/nedbat/coveragepy/issues/1278 The raise_through_with skip is noted in https://github.com/nedbat/coveragepy/issues/1270
-rw-r--r--.github/workflows/coverage.yml1
-rw-r--r--.github/workflows/kit.yml13
-rw-r--r--.github/workflows/testsuite.yml1
-rw-r--r--CHANGES.rst2
-rw-r--r--README.rst2
-rw-r--r--coverage/ctracer/util.h8
-rw-r--r--doc/index.rst2
-rw-r--r--setup.py1
-rw-r--r--tests/test_arcs.py2
-rw-r--r--tests/test_process.py2
-rw-r--r--tox.ini5
11 files changed, 33 insertions, 6 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index cbfd44ec..3e12f01b 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -38,6 +38,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
+ - "3.11.0-alpha.2"
- "pypy3"
exclude:
# Windows PyPy doesn't seem to work?
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index fc454858..3aa67dde 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -4,6 +4,15 @@
# Based on:
# https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml
+# To test installing wheels without uploading them to PyPI:
+#
+# $ mkdir /tmp/pypi
+# $ cp dist/* /tmp/pypi
+# $ python -m pip install piprepo
+# $ piprepo build /tmp/pypi
+# $ python -m pip install -v coverage --index-url=file:///tmp/pypi/simple
+#
+
name: "Kits"
on:
@@ -197,7 +206,7 @@ jobs:
prerel:
name: "Build pre-rel ${{ matrix.os }} ${{ matrix.py }} wheels"
- if: ${{ false }} # disable for now, since there are no pre-rel Python versions.
+ if: ${{ true }} # true when there are pre-rel, false when not.
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
@@ -206,7 +215,7 @@ jobs:
- windows
- macos
py:
- - "3.10.0-rc.2"
+ - "3.11.0-alpha.2"
fail-fast: false
steps:
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index d4299074..6f31f48f 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -37,6 +37,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
+ - "3.11.0-alpha.2"
- "pypy3"
exclude:
# Windows PyPy doesn't seem to work?
diff --git a/CHANGES.rst b/CHANGES.rst
index 015f7db8..30c1351d 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,8 @@ This list is detailed and covers changes in each pre-release version.
Unreleased
----------
+- Python 3.11 is supported (tested with 3.11.0a2).
+
- Fix: When remapping file paths through the ``[paths]`` setting while
combining, the ``[run] relative_files`` setting was ignored, resulting in
absolute paths for remapped file names (`issue 1147`_). This is now fixed.
diff --git a/README.rst b/README.rst
index e34a2dce..777bbb98 100644
--- a/README.rst
+++ b/README.rst
@@ -19,7 +19,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.
+* CPython 3.6 through 3.11.
* PyPy3 7.3.7.
Documentation is on `Read the Docs`_. Code repository and issue tracker are on
diff --git a/coverage/ctracer/util.h b/coverage/ctracer/util.h
index ff139329..58fa1d49 100644
--- a/coverage/ctracer/util.h
+++ b/coverage/ctracer/util.h
@@ -12,9 +12,15 @@
#undef COLLECT_STATS /* Collect counters: stats are printed when tracer is stopped. */
#undef DO_NOTHING /* Define this to make the tracer do nothing. */
+#if PY_VERSION_HEX >= 0x030B00A0
+// 3.11 moved f_lasti into an internal structure. This is totally the wrong way
+// to make this work, but it's all I've got until https://bugs.python.org/issue40421
+// is resolved.
+#include <internal/pycore_frame.h>
+#define MyFrame_lasti(f) ((f)->f_frame->f_lasti * 2)
+#elif PY_VERSION_HEX >= 0x030A00A7
// The f_lasti field changed meaning in 3.10.0a7. It had been bytes, but
// now is instructions, so we need to adjust it to use it as a byte index.
-#if PY_VERSION_HEX >= 0x030A00A7
#define MyFrame_lasti(f) ((f)->f_lasti * 2)
#else
#define MyFrame_lasti(f) ((f)->f_lasti)
diff --git a/doc/index.rst b/doc/index.rst
index 37fe33ee..6bc00750 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -16,7 +16,7 @@ not.
The latest version is coverage.py |release|, released |release_date|. It is
supported on:
-* Python versions 3.6 through 3.10.
+* Python versions 3.6 through 3.11.
* PyPy3 7.3.7.
diff --git a/setup.py b/setup.py
index 83553c92..b396a6dd 100644
--- a/setup.py
+++ b/setup.py
@@ -44,6 +44,7 @@ Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
+Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Quality Assurance
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 6a65d4fe..349a560f 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -279,6 +279,8 @@ class WithTest(CoverageTest):
arcz=arcz,
)
+ @pytest.mark.skipif(env.PYVERSION[:2] >= (3, 11), reason="avoid a 3.11 bug: 45709")
+ # https://github.com/nedbat/coveragepy/issues/1270
def test_raise_through_with(self):
if env.PYBEHAVIOR.exit_through_with:
arcz = ".1 12 27 78 8. 9A A. -23 34 45 53 6-2"
diff --git a/tests/test_process.py b/tests/test_process.py
index 1e644864..83ca1feb 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -748,6 +748,8 @@ class ProcessTest(CoverageTest):
@pytest.mark.expensive
@pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
@pytest.mark.skipif(not env.C_TRACER, reason="fullcoverage only works with the C tracer.")
+ @pytest.mark.skipif(env.PYVERSION[:2] >= (3, 11), reason="this test needs work on 3.11")
+ # https://github.com/nedbat/coveragepy/issues/1278
def test_fullcoverage(self):
# fullcoverage is a trick to get stdlib modules measured from
# the very beginning of the process. Here we import os and
diff --git a/tox.ini b/tox.ini
index 3f39965d..31162ac7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@
[tox]
# When changing this list, be sure to check the [gh-actions] list below.
-envlist = py{36,37,38,39,310}, pypy3, doc, lint
+envlist = py{36,37,38,39,310,311}, pypy3, doc, lint
skip_missing_interpreters = {env:COVERAGE_SKIP_MISSING_INTERPRETERS:True}
toxworkdir = {env:TOXWORKDIR:.tox}
@@ -32,6 +32,8 @@ setenv =
# For some tests, we need .pyc files written in the current directory,
# so override any local setting.
PYTHONPYCACHEPREFIX=
+ # PyContracts can't do 3.11.
+ py311: COVERAGE_NO_CONTRACTS=1
commands =
# Create tests/zipmods.zip
@@ -95,4 +97,5 @@ python =
3.8: py38
3.9: py39
3.10: py310
+ 3.11: py311
pypy3: pypy3