From 482d428a40b07ae188cf402f25e420d323f82f05 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 29 May 2023 16:11:42 -0400
Subject: [PATCH 01/83] build: bump version
---
CHANGES.rst | 6 ++++++
coverage/version.py | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 4b567d6dc..f84a26a8a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -17,6 +17,12 @@ development at the same time, such as 4.5.x and 5.0.
.. Version 9.8.1 — 2027-07-27
.. --------------------------
+Unreleased
+----------
+
+Nothing yet.
+
+
.. scriv-start-here
.. _changes_7-2-7:
diff --git a/coverage/version.py b/coverage/version.py
index c48974967..cfaf8a74b 100644
--- a/coverage/version.py
+++ b/coverage/version.py
@@ -8,8 +8,8 @@
# version_info: same semantics as sys.version_info.
# _dev: the .devN suffix if any.
-version_info = (7, 2, 7, "final", 0)
-_dev = 0
+version_info = (7, 2, 8, "alpha", 0)
+_dev = 1
def _make_version(
From 585bc7332c398b91abf970c083bcadb2788796d3 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 29 May 2023 16:56:00 -0400
Subject: [PATCH 02/83] build: better comments in ghrel_template.md.j2
---
ci/ghrel_template.md.j2 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ci/ghrel_template.md.j2 b/ci/ghrel_template.md.j2
index 9d626bcab..e24d72976 100644
--- a/ci/ghrel_template.md.j2
+++ b/ci/ghrel_template.md.j2
@@ -1,4 +1,6 @@
-
+{# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -#}
+{# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt -#}
+{# This file is for use with scriv to create GitHub releases. -#}
{{body}}
:arrow_right: PyPI page: [coverage {{version}}](https://pypi.org/project/coverage/{{version}}).
From 7f71de6da6c105583148c968653e81786bd7f426 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Tue, 30 May 2023 22:12:47 -0400
Subject: [PATCH 03/83] docs: restructure how docs are built
- Docs are built with 3.10, because Sphinx doesn't support 3.7 now. They
follow NEP-29 (https://numpy.org/neps/nep-0029-deprecation_policy.html), so will
drop versions quicker than I will.
- Doc requirements are pinned using the tox doc environment (3.10).
- Use sphinx-code-tabs to get tabs back.
- Simplify how we use sphinx-rtd-theme.
- Disable spelling support and doc8 because we can't find versions that
are compatible. Maybe soon everything will catch up and we can
re-enable them.
---
Makefile | 13 +++++++++----
doc/_static/coverage.css | 15 ++++++++++-----
doc/conf.py | 17 +++++------------
doc/index.rst | 34 ++++++++++++++++++----------------
doc/requirements.in | 12 +++++++-----
doc/requirements.pip | 34 +++++++++-------------------------
requirements/dev.pip | 2 +-
requirements/lint.pip | 14 +++++---------
requirements/mypy.pip | 2 +-
requirements/pins.pip | 12 +++---------
requirements/pytest.pip | 2 +-
tox.ini | 7 +++++--
12 files changed, 74 insertions(+), 90 deletions(-)
diff --git a/Makefile b/Makefile
index b5276a944..6d82658ff 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ smoke: ## Run tests quickly with the C tracer in the lowest supported Pytho
##@ Metacov: coverage measurement of coverage.py itself
-# See metacov.ini for details.
+# See metacov.ini for details.
.PHONY: metacov metahtml metasmoke
@@ -84,7 +84,9 @@ metasmoke:
# in requirements/pins.pip, and search for "windows" in .in files to find pins
# and extra requirements that have been needed, but might be obsolete.
-.PHONY: upgrade
+.PHONY: upgrade doc_upgrade diff_upgrade
+
+DOCBIN = .tox/doc/bin
PIP_COMPILE = pip-compile --upgrade --allow-unsafe --resolver=backtracking
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
@@ -97,10 +99,14 @@ upgrade: ## Update the *.pip files with the latest packages satisfying *.in
$(PIP_COMPILE) -o requirements/tox.pip requirements/tox.in
$(PIP_COMPILE) -o requirements/dev.pip requirements/dev.in
$(PIP_COMPILE) -o requirements/light-threads.pip requirements/light-threads.in
- $(PIP_COMPILE) -o doc/requirements.pip doc/requirements.in
$(PIP_COMPILE) -o requirements/lint.pip doc/requirements.in requirements/dev.in
$(PIP_COMPILE) -o requirements/mypy.pip requirements/mypy.in
+doc_upgrade: export CUSTOM_COMPILE_COMMAND=make doc_upgrade
+doc_upgrade: $(DOCBIN) ## Update the doc/requirements.pip file
+ $(DOCBIN)/pip install -q -r requirements/pip-tools.pip
+ $(DOCBIN)/$(PIP_COMPILE) -o doc/requirements.pip doc/requirements.in
+
diff_upgrade: ## Summarize the last `make upgrade`
@# The sort flags sort by the package name first, then by the -/+, and
@# sort by version numbers, so we get a summary with lines like this:
@@ -219,7 +225,6 @@ bump_version: ## Edit sources to bump the version after a release.
.PHONY: cogdoc dochtml docdev docspell
-DOCBIN = .tox/doc/bin
SPHINXOPTS = -aE
SPHINXBUILD = $(DOCBIN)/sphinx-build $(SPHINXOPTS)
SPHINXAUTOBUILD = $(DOCBIN)/sphinx-autobuild --port 9876 --ignore '.git/**' --open-browser
diff --git a/doc/_static/coverage.css b/doc/_static/coverage.css
index a85fe4312..b4d8428a4 100644
--- a/doc/_static/coverage.css
+++ b/doc/_static/coverage.css
@@ -26,7 +26,16 @@ img.tideliftlogo {
margin-bottom: 12px;
}
-/* Tabs */
+/* sphinx-code-tabs */
+
+.tabs.container {
+ margin-bottom: 1em;
+}
+
+.tab.selected {
+ border: 1px solid #ccc;
+ border-radius: 0 .5em .5em .5em;
+}
.ui.menu {
font-family: Helvetica;
@@ -41,10 +50,6 @@ img.tideliftlogo {
padding: 0;
}
-.sphinx-tabs {
- margin-bottom: 1em;
-}
-
.sig {
font-family: Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;
}
diff --git a/doc/conf.py b/doc/conf.py
index bee8c14b2..4cef1f33e 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -39,13 +39,14 @@
'sphinx.ext.intersphinx',
'sphinxcontrib.restbuilder',
'sphinx.ext.napoleon',
- #'sphinx_tabs.tabs',
+ 'sphinx_code_tabs',
+ 'sphinx_rtd_theme',
]
autodoc_typehints = "description"
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = []
# The suffix of source filenames.
source_suffix = '.rst'
@@ -141,15 +142,7 @@
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
-#html_theme = 'default'
-
-if not on_rtd: # only import and set the theme if we're building docs locally
- import sphinx_rtd_theme
- html_theme = 'sphinx_rtd_theme'
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
-
-# otherwise, readthedocs.org uses their theme by default, so no need to specify it
-
+html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -159,7 +152,7 @@
#html_add_permalinks = ""
# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = ['_templates']
+#html_theme_path = ['_templates']
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
diff --git a/doc/index.rst b/doc/index.rst
index 2475eb402..fe8dacaed 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -16,11 +16,11 @@ not.
The latest version is coverage.py |release|, released |release_date|. It is
supported on:
-.. PYVERSIONS
-
* Python versions 3.7 through 3.12.0b1.
* PyPy3 7.3.11.
+.. PYVERSIONS
+
.. ifconfig:: prerelease
**This is a pre-release build. The usual warnings about possible bugs
@@ -73,7 +73,9 @@ Getting started is easy:
Other instructions for specific test runners:
- - **pytest**
+ .. tabs::
+
+ .. tab:: pytest
If you usually use::
@@ -86,7 +88,7 @@ Getting started is easy:
Many people choose to use the `pytest-cov`_ plugin, but for most
purposes, it is unnecessary.
- - **unittest**
+ .. tab:: unittest
Change "python" to "coverage run", so this::
@@ -96,18 +98,18 @@ Getting started is easy:
$ coverage run -m unittest discover
- .. - **nosetest**
- ..
- .. *Nose has been unmaintained for a long time. You should seriously
- .. consider adopting a different test runner.*
- ..
- .. Change this::
- ..
- .. $ nosetests arg1 arg2
- ..
- .. to this::
- ..
- .. $ coverage run -m nose arg1 arg2
+ .. tab:: nosetest
+
+ *Nose has been unmaintained for a long time. You should seriously
+ consider adopting a different test runner.*
+
+ Change this::
+
+ $ nosetests arg1 arg2
+
+ to::
+
+ $ coverage run -m nose arg1 arg2
To limit coverage measurement to code in the current directory, and also
find files that weren't executed at all, add the ``--source=.`` argument to
diff --git a/doc/requirements.in b/doc/requirements.in
index 42eca4052..6d1bd330f 100644
--- a/doc/requirements.in
+++ b/doc/requirements.in
@@ -2,17 +2,19 @@
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
# PyPI requirements input for building documentation for coverage.py
-# "make upgrade" turns this into doc/requirements.pip
+# "make doc_upgrade" turns this into doc/requirements.pip
-c ../requirements/pins.pip
cogapp
-#doc8
-pyenchant
scriv # for writing GitHub releases
sphinx
sphinx-autobuild
sphinx_rtd_theme
-#sphinx-tabs
+sphinx-code-tabs
sphinxcontrib-restbuilder
-sphinxcontrib-spelling
+
+# These aren't compatible atm with other library versions:
+#doc8
+#pyenchant
+#sphinxcontrib-spelling
diff --git a/doc/requirements.pip b/doc/requirements.pip
index a1894b64f..462426ae8 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -1,8 +1,8 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
-# make upgrade
+# make doc_upgrade
#
alabaster==0.7.13
# via sphinx
@@ -32,12 +32,6 @@ idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
-importlib-metadata==6.6.0
- # via
- # attrs
- # click
- # sphinx
- # sphinxcontrib-spelling
jinja2==3.1.2
# via
# scriv
@@ -48,14 +42,8 @@ markupsafe==2.1.2
# via jinja2
packaging==23.1
# via sphinx
-pyenchant==3.2.2
- # via
- # -r doc/requirements.in
- # sphinxcontrib-spelling
pygments==2.15.1
# via sphinx
-pytz==2023.3
- # via babel
requests==2.31.0
# via
# scriv
@@ -66,23 +54,25 @@ six==1.16.0
# via livereload
snowballstemmer==2.2.0
# via sphinx
-sphinx==5.3.0
+sphinx==6.2.1
# via
# -r doc/requirements.in
# sphinx-autobuild
+ # sphinx-code-tabs
# sphinx-rtd-theme
# sphinxcontrib-jquery
# sphinxcontrib-restbuilder
- # sphinxcontrib-spelling
sphinx-autobuild==2021.3.14
# via -r doc/requirements.in
+sphinx-code-tabs==0.5.3
+ # via -r doc/requirements.in
sphinx-rtd-theme==1.2.1
# via -r doc/requirements.in
-sphinxcontrib-applehelp==1.0.2
+sphinxcontrib-applehelp==1.0.4
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
-sphinxcontrib-htmlhelp==2.0.0
+sphinxcontrib-htmlhelp==2.0.1
# via sphinx
sphinxcontrib-jquery==4.1
# via sphinx-rtd-theme
@@ -94,13 +84,7 @@ sphinxcontrib-restbuilder==0.3
# via -r doc/requirements.in
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
-sphinxcontrib-spelling==8.0.0
- # via -r doc/requirements.in
-tornado==6.2
+tornado==6.3.2
# via livereload
-typing-extensions==4.6.2
- # via importlib-metadata
urllib3==2.0.2
# via requests
-zipp==3.15.0
- # via importlib-metadata
diff --git a/requirements/dev.pip b/requirements/dev.pip
index 0cd90a3c4..3d9414583 100644
--- a/requirements/dev.pip
+++ b/requirements/dev.pip
@@ -49,7 +49,7 @@ flaky==3.7.0
# via -r requirements/pytest.in
greenlet==2.0.2
# via -r requirements/dev.in
-hypothesis==6.75.6
+hypothesis==6.75.7
# via -r requirements/pytest.in
idna==3.4
# via requests
diff --git a/requirements/lint.pip b/requirements/lint.pip
index 9ba71d60d..9c5d9f79a 100644
--- a/requirements/lint.pip
+++ b/requirements/lint.pip
@@ -67,7 +67,7 @@ flaky==3.7.0
# via -r requirements/pytest.in
greenlet==2.0.2
# via -r requirements/dev.in
-hypothesis==6.75.6
+hypothesis==6.75.7
# via -r requirements/pytest.in
idna==3.4
# via requests
@@ -82,7 +82,6 @@ importlib-metadata==6.6.0
# pluggy
# pytest
# sphinx
- # sphinxcontrib-spelling
# tox
# twine
# virtualenv
@@ -141,10 +140,6 @@ pluggy==1.0.0
# tox
pudb==2022.1.3
# via -r requirements/dev.in
-pyenchant==3.2.2
- # via
- # -r doc/requirements.in
- # sphinxcontrib-spelling
pygments==2.15.1
# via
# pudb
@@ -194,14 +189,17 @@ sortedcontainers==2.4.0
# via hypothesis
sphinx==5.3.0
# via
+ # -c requirements/pins.pip
# -r doc/requirements.in
# sphinx-autobuild
+ # sphinx-code-tabs
# sphinx-rtd-theme
# sphinxcontrib-jquery
# sphinxcontrib-restbuilder
- # sphinxcontrib-spelling
sphinx-autobuild==2021.3.14
# via -r doc/requirements.in
+sphinx-code-tabs==0.5.3
+ # via -r doc/requirements.in
sphinx-rtd-theme==1.2.1
# via -r doc/requirements.in
sphinxcontrib-applehelp==1.0.2
@@ -220,8 +218,6 @@ sphinxcontrib-restbuilder==0.3
# via -r doc/requirements.in
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
-sphinxcontrib-spelling==8.0.0
- # via -r doc/requirements.in
tomli==2.0.1
# via
# build
diff --git a/requirements/mypy.pip b/requirements/mypy.pip
index f3146a23e..a019d96fc 100644
--- a/requirements/mypy.pip
+++ b/requirements/mypy.pip
@@ -16,7 +16,7 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.6
+hypothesis==6.75.7
# via -r requirements/pytest.in
importlib-metadata==6.6.0
# via
diff --git a/requirements/pins.pip b/requirements/pins.pip
index 3b38dcb3f..97e4b2974 100644
--- a/requirements/pins.pip
+++ b/requirements/pins.pip
@@ -3,12 +3,6 @@
# Version pins, for use as a constraints file.
-# docutils has been going through some turmoil. Different packages require it,
-# but have different pins. This seems to satisfy them all:
-#docutils>=0.17,<0.18
-
-# Setuptools became stricter about version number syntax. But it shouldn't be
-# checking the Python version like that, should it?
-# https://github.com/pypa/packaging/issues/678
-# https://github.com/nedbat/coveragepy/issues/1556
-#setuptools<66.0.0
+# sphinx-rtd-theme wants <7
+# https://github.com/readthedocs/sphinx_rtd_theme/issues/1463
+Sphinx<7
diff --git a/requirements/pytest.pip b/requirements/pytest.pip
index d34f3d3d7..92fb30b9a 100644
--- a/requirements/pytest.pip
+++ b/requirements/pytest.pip
@@ -16,7 +16,7 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.6
+hypothesis==6.75.7
# via -r requirements/pytest.in
importlib-metadata==6.6.0
# via
diff --git a/tox.ini b/tox.ini
index 80b31897e..36c870f9e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,6 +55,9 @@ commands =
basepython = {env:COVERAGE_ANYPY}
[testenv:doc]
+# One of the PYVERSIONS, that's currently supported by Sphinx.
+basepython = python3.10
+
# Build the docs so we know if they are successful. We build twice: once with
# -q to get all warnings, and once with -QW to get a success/fail status
# return.
@@ -65,7 +68,7 @@ allowlist_externals =
commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
- #doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
+ ;doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
sphinx-build -b html -aEnqW doc doc/_build/html
rst2html.py --strict README.rst doc/_build/trash
- sphinx-build -b html -b linkcheck -aEnq doc doc/_build/html
@@ -86,7 +89,7 @@ commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
python -m cogapp -cP --check --verbosity=1 .github/workflows/*.yml
- #doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
+ ;doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
python -m pylint --notes= {env:LINTABLE}
check-manifest --ignore 'doc/sample_html/*,.treerc'
# If 'build -q' becomes a thing (https://github.com/pypa/build/issues/188),
From ba6a6a63f1704cf2911d8595ec50c505a98f5aaa Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 06:40:58 -0400
Subject: [PATCH 04/83] build(refactor): clean up the Makefile
---
Makefile | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 6d82658ff..37790bf5d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,16 @@
.DEFAULT_GOAL := help
+
##@ Utilities
.PHONY: help clean_platform clean sterile
+help: ## Show this help.
+ @# Adapted from https://www.thapaliya.com/en/writings/well-documented-makefiles/
+ @echo Available targets:
+ @awk -F ':.*##' '/^[^: ]+:.*##/{printf " \033[1m%-20s\033[m %s\n",$$1,$$2} /^##@/{printf "\n%s\n",substr($$0,5)}' $(MAKEFILE_LIST)
+
clean_platform:
@rm -f *.so */*.so
@rm -f *.pyd */*.pyd
@@ -40,10 +46,6 @@ sterile: clean ## Remove all non-controlled content, even if expensive.
rm -rf .tox
rm -f cheats.txt
-help: ## Show this help.
- @# Adapted from https://www.thapaliya.com/en/writings/well-documented-makefiles/
- @echo Available targets:
- @awk -F ':.*##' '/^[^: ]+:.*##/{printf " \033[1m%-20s\033[m %s\n",$$1,$$2} /^##@/{printf "\n%s\n",substr($$0,5)}' $(MAKEFILE_LIST)
##@ Tests and quality checks
@@ -116,6 +118,7 @@ diff_upgrade: ## Summarize the last `make upgrade`
@# +build==0.10.0
@git diff -U0 | grep -v '^@' | grep == | sort -k1.2,1.99 -k1.1,1.1r -u -V
+
##@ Pre-builds for prepping the code
.PHONY: css workflows prebuild
@@ -159,8 +162,9 @@ sample_html_beta: _sample_cog_html ## Generate sample HTML report for a beta rel
##@ Kitting: making releases
-.PHONY: kit kit_upload test_upload kit_local build_kits download_kits check_kits tag
-.PHONY: update_stable comment_on_fixes
+.PHONY: edit_for_release cheats relbranch relcommit1 relcommit2
+.PHONY: kit kit_upload test_upload kit_local build_kits download_kits check_kits
+.PHONY: tag update_stable bump_version
REPO_OWNER = nedbat/coveragepy
@@ -228,9 +232,6 @@ bump_version: ## Edit sources to bump the version after a release.
SPHINXOPTS = -aE
SPHINXBUILD = $(DOCBIN)/sphinx-build $(SPHINXOPTS)
SPHINXAUTOBUILD = $(DOCBIN)/sphinx-autobuild --port 9876 --ignore '.git/**' --open-browser
-WEBHOME = ~/web/stellated
-WEBSAMPLE = $(WEBHOME)/files/sample_coverage_html
-WEBSAMPLEBETA = $(WEBHOME)/files/sample_coverage_html_beta
$(DOCBIN):
tox -q -e doc --notest
@@ -250,7 +251,11 @@ docspell: $(DOCBIN) ## Run the spell checker on the docs.
##@ Publishing docs
-.PHONY: publish publishbeta relnotes_json github_releases
+.PHONY: publish publishbeta relnotes_json github_releases comment_on_fixes
+
+WEBHOME = ~/web/stellated
+WEBSAMPLE = $(WEBHOME)/files/sample_coverage_html
+WEBSAMPLEBETA = $(WEBHOME)/files/sample_coverage_html_beta
publish: ## Publish the sample HTML report.
rm -f $(WEBSAMPLE)/*.*
From 23d1eb564ee1f1367b8e32d5d860f8404f9eca74 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 08:20:27 -0400
Subject: [PATCH 05/83] docs(style): tabs styling
---
doc/_static/coverage.css | 47 ++++++++++++++++++++++++++++++----------
1 file changed, 36 insertions(+), 11 deletions(-)
diff --git a/doc/_static/coverage.css b/doc/_static/coverage.css
index b4d8428a4..5dd8961a6 100644
--- a/doc/_static/coverage.css
+++ b/doc/_static/coverage.css
@@ -26,17 +26,6 @@ img.tideliftlogo {
margin-bottom: 12px;
}
-/* sphinx-code-tabs */
-
-.tabs.container {
- margin-bottom: 1em;
-}
-
-.tab.selected {
- border: 1px solid #ccc;
- border-radius: 0 .5em .5em .5em;
-}
-
.ui.menu {
font-family: Helvetica;
min-height: 0;
@@ -76,3 +65,39 @@ img.tideliftlogo {
color: #404040;
background: #efc;
}
+
+/* sphinx-code-tabs */
+
+/* Some selectors here are extra-specific (.container) because this file comes
+ * before code-tabs.css, so we need the specificity to override it.
+ */
+
+div.tabs.container > ul.tabbar > li.tabbutton {
+ color: #666;
+ background-color: #ddd;
+ border-color: #aaa;
+}
+
+div.tabs.container > ul.tabbar > li.tabbutton:hover {
+ background-color: #eee;
+}
+
+div.tabs.container > ul.tabbar > li.tabbutton.selected {
+ color: black;
+ background-color: #fff;
+ border-color: #aaa;
+ border-bottom-color: #fff;
+}
+
+div.tabs.container > ul.tabbar > li.tabbutton.selected:hover {
+ background-color: #fff;
+}
+
+div.tabs.container {
+ margin-bottom: 1em;
+}
+
+div.tab.selected {
+ border: 1px solid #ccc;
+ border-radius: 0 .5em .5em .5em;
+}
From 66dea3de3fe81717ccb307606ce8c0d08549136b Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 08:46:16 -0400
Subject: [PATCH 06/83] build(docs): readthedocs needs to also be on 3.10
---
.readthedocs.yml | 2 +-
tox.ini | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 48d6b434d..ce190bc37 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -18,7 +18,7 @@ formats:
python:
# PYVERSIONS
- version: 3.7
+ version: 3.10
install:
- requirements: doc/requirements.pip
- method: pip
diff --git a/tox.ini b/tox.ini
index 36c870f9e..f95788f6b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,7 +55,8 @@ commands =
basepython = {env:COVERAGE_ANYPY}
[testenv:doc]
-# One of the PYVERSIONS, that's currently supported by Sphinx.
+# One of the PYVERSIONS, that's currently supported by Sphinx. Make sure it
+# matches the `python:version:` in the .readthedocs.yml file.
basepython = python3.10
# Build the docs so we know if they are successful. We build twice: once with
From f5977440a44f3209095de5056d90cb59360cf4d5 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 08:58:13 -0400
Subject: [PATCH 07/83] build: tests can be skipped with a -notests branch name
---
.github/workflows/testsuite.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index 8ab3608bc..d87a5c725 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -31,7 +31,8 @@ jobs:
tests:
name: "${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
-
+ # Don't run tests if the branch name includes "-notests"
+ if: "!contains(github.ref, '-notests')"
strategy:
matrix:
os:
@@ -94,7 +95,8 @@ jobs:
# https://github.com/orgs/community/discussions/33579
success:
name: Tests successful
- if: always()
+ # The tests didn't run if the branch name includes "-notests"
+ if: "!contains(github.ref, '-notests')"
needs:
- tests
runs-on: ubuntu-latest
From 3d59d8da2b06245e06338964241cd1f53d1b759f Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 09:17:35 -0400
Subject: [PATCH 08/83] build(docs): readthedocs latest version is 3.8
---
.github/workflows/quality.yml | 2 +-
.readthedocs.yml | 4 ++--
tox.ini | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
index 9ee690df9..0c5d6119f 100644
--- a/.github/workflows/quality.yml
+++ b/.github/workflows/quality.yml
@@ -88,7 +88,7 @@ jobs:
- name: "Install Python"
uses: "actions/setup-python@v4"
with:
- python-version: "3.7" # Minimum of PYVERSIONS
+ python-version: "3.8" # Doc version from PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'
diff --git a/.readthedocs.yml b/.readthedocs.yml
index ce190bc37..6fc44857a 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -17,8 +17,8 @@ formats:
- pdf
python:
- # PYVERSIONS
- version: 3.10
+ # PYVERSIONS: the version we use for building docs. Check tox.ini[doc] also.
+ version: 3.8
install:
- requirements: doc/requirements.pip
- method: pip
diff --git a/tox.ini b/tox.ini
index f95788f6b..af0ffe726 100644
--- a/tox.ini
+++ b/tox.ini
@@ -56,8 +56,9 @@ basepython = {env:COVERAGE_ANYPY}
[testenv:doc]
# One of the PYVERSIONS, that's currently supported by Sphinx. Make sure it
-# matches the `python:version:` in the .readthedocs.yml file.
-basepython = python3.10
+# matches the `python:version:` in the .readthedocs.yml file, and the
+# python-version in the `doc` job in the .github/workflows/quality.yml workflow.
+basepython = python3.8
# Build the docs so we know if they are successful. We build twice: once with
# -q to get all warnings, and once with -QW to get a success/fail status
From 81bc53843806c0ec48c63399cb6c3d3fc23fba20 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 09:23:30 -0400
Subject: [PATCH 09/83] chore: make upgrade
---
doc/requirements.pip | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/doc/requirements.pip b/doc/requirements.pip
index 462426ae8..5b84f03cd 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.10
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make doc_upgrade
@@ -32,6 +32,8 @@ idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
+importlib-metadata==6.6.0
+ # via sphinx
jinja2==3.1.2
# via
# scriv
@@ -44,6 +46,8 @@ packaging==23.1
# via sphinx
pygments==2.15.1
# via sphinx
+pytz==2023.3
+ # via babel
requests==2.31.0
# via
# scriv
@@ -88,3 +92,5 @@ tornado==6.3.2
# via livereload
urllib3==2.0.2
# via requests
+zipp==3.15.0
+ # via importlib-metadata
From 5803cfeb12662d571efa23f33087c89f8c32ba7c Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 29 May 2023 11:07:58 -0400
Subject: [PATCH 10/83] style: disable mindless security alarms
Somehow GitLab can run semgrep against my code, and alert me to
"security issues" that don't actually exist. This is because it's using
semgrep, which is cool, but not cool enough to understand what the code
is doing. It thinks any square bracket indexing with a variable is a
security risk: https://semgrep.dev/r?q=gitlab.eslint.detect-object-injection
These comments tell it to not worry about them.
From the original report:
I just want to let you know that GitLab's SAST Analysis reports the
vulnerability mentioned in the Summary in the coverage_html.js on all
the following lines: 37, 103, 119, 123, 124, 126, 147, 155, 162, 187,
253
See: https://semgrep.dev/r/gitlab.eslint.detect-object-injection
---
CHANGES.rst | 4 +++-
coverage/htmlfiles/coverage_html.js | 22 +++++++++++-----------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index f84a26a8a..a066a68f0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,7 +20,9 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
-Nothing yet.
+- Fix: add ``nosemgrep`` comments to our JavaScript code so that semgrep-based
+ SAST security checks won't raise false alarms about security problems that
+ aren't problems.
.. scriv-start-here
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js
index 4c321182c..593488286 100644
--- a/coverage/htmlfiles/coverage_html.js
+++ b/coverage/htmlfiles/coverage_html.js
@@ -34,7 +34,7 @@ function on_click(sel, fn) {
// Helpers for table sorting
function getCellValue(row, column = 0) {
- const cell = row.cells[column]
+ const cell = row.cells[column] // nosemgrep: eslint.detect-object-injection
if (cell.childElementCount == 1) {
const child = cell.firstElementChild
if (child instanceof HTMLTimeElement && child.dateTime) {
@@ -100,7 +100,7 @@ coverage.wire_up_filter = function () {
// Keep running total of each metric, first index contains number of shown rows
const totals = new Array(table.rows[0].cells.length).fill(0);
// Accumulate the percentage as fraction
- totals[totals.length - 1] = { "numer": 0, "denom": 0 };
+ totals[totals.length - 1] = { "numer": 0, "denom": 0 }; // nosemgrep: eslint.detect-object-injection
// Hide / show elements.
table_body_rows.forEach(row => {
@@ -116,14 +116,14 @@ coverage.wire_up_filter = function () {
for (let column = 1; column < totals.length; column++) {
// Accumulate dynamic totals
- cell = row.cells[column]
+ cell = row.cells[column] // nosemgrep: eslint.detect-object-injection
if (column === totals.length - 1) {
// Last column contains percentage
const [numer, denom] = cell.dataset.ratio.split(" ");
- totals[column]["numer"] += parseInt(numer, 10);
- totals[column]["denom"] += parseInt(denom, 10);
+ totals[column]["numer"] += parseInt(numer, 10); // nosemgrep: eslint.detect-object-injection
+ totals[column]["denom"] += parseInt(denom, 10); // nosemgrep: eslint.detect-object-injection
} else {
- totals[column] += parseInt(cell.textContent, 10);
+ totals[column] += parseInt(cell.textContent, 10); // nosemgrep: eslint.detect-object-injection
}
}
});
@@ -144,7 +144,7 @@ coverage.wire_up_filter = function () {
// Calculate new dynamic sum values based on visible rows.
for (let column = 1; column < totals.length; column++) {
// Get footer cell element.
- const cell = footer.cells[column];
+ const cell = footer.cells[column]; // nosemgrep: eslint.detect-object-injection
// Set value into dynamic footer cell element.
if (column === totals.length - 1) {
@@ -152,14 +152,14 @@ coverage.wire_up_filter = function () {
// and adapts to the number of decimal places.
const match = /\.([0-9]+)/.exec(cell.textContent);
const places = match ? match[1].length : 0;
- const { numer, denom } = totals[column];
+ const { numer, denom } = totals[column]; // nosemgrep: eslint.detect-object-injection
cell.dataset.ratio = `${numer} ${denom}`;
// Check denom to prevent NaN if filtered files contain no statements
cell.textContent = denom
? `${(numer * 100 / denom).toFixed(places)}%`
: `${(100).toFixed(places)}%`;
} else {
- cell.textContent = totals[column];
+ cell.textContent = totals[column]; // nosemgrep: eslint.detect-object-injection
}
}
}));
@@ -184,7 +184,7 @@ coverage.index_ready = function () {
if (stored_list) {
const {column, direction} = JSON.parse(stored_list);
- const th = document.querySelector("[data-sortable]").tHead.rows[0].cells[column];
+ const th = document.querySelector("[data-sortable]").tHead.rows[0].cells[column]; // nosemgrep: eslint.detect-object-injection
th.setAttribute("aria-sort", direction === "ascending" ? "descending" : "ascending");
th.click()
}
@@ -250,7 +250,7 @@ coverage.pyfile_ready = function () {
}
for (cls in coverage.filters) {
- coverage.set_line_visibilty(cls, coverage.filters[cls]);
+ coverage.set_line_visibilty(cls, coverage.filters[cls]); // nosemgrep: eslint.detect-object-injection
}
coverage.assign_shortkeys();
From 6e9d76f8e671b8db465bd6a6054a9de676d249d6 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 31 May 2023 19:03:19 -0400
Subject: [PATCH 11/83] docs: make the warning about nose stronger
---
doc/index.rst | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/doc/index.rst b/doc/index.rst
index fe8dacaed..e70ec7699 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -100,8 +100,8 @@ Getting started is easy:
.. tab:: nosetest
- *Nose has been unmaintained for a long time. You should seriously
- consider adopting a different test runner.*
+ .. note:: Nose has been `unmaintained since at least 2015 `_.
+ *You should seriously consider using a different test runner.*
Change this::
@@ -143,6 +143,7 @@ Getting started is easy:
.. _report like this: https://nedbatchelder.com/files/sample_coverage_html/index.html
.. _report like this one: https://nedbatchelder.com/files/sample_coverage_html_beta/index.html
+.. _nose state: https://github.com/nose-devs/nose/commit/0f40fa995384afad77e191636c89eb7d5b8870ca
Capabilities
From b9e02a699bdbc222d99404474c838cbdce49f313 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 1 Jun 2023 06:17:27 -0400
Subject: [PATCH 12/83] docs(build): use 3.11 on rtfd, with the correct yml
options
---
.github/workflows/quality.yml | 2 +-
.readthedocs.yml | 16 +++++++---------
tox.ini | 2 +-
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
index 0c5d6119f..11d2e3fc0 100644
--- a/.github/workflows/quality.yml
+++ b/.github/workflows/quality.yml
@@ -88,7 +88,7 @@ jobs:
- name: "Install Python"
uses: "actions/setup-python@v4"
with:
- python-version: "3.8" # Doc version from PYVERSIONS
+ python-version: "3.11" # Doc version from PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 6fc44857a..d9f581bf1 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -6,21 +6,19 @@
version: 2
+build:
+ os: ubuntu-22.04
+ tools:
+ # PYVERSIONS: the version we use for building docs. Check tox.ini[doc] also.
+ python: "3.11"
+
sphinx:
builder: html
configuration: doc/conf.py
# Build all the formats
-formats:
- - epub
- - htmlzip
- - pdf
+formats: all
python:
- # PYVERSIONS: the version we use for building docs. Check tox.ini[doc] also.
- version: 3.8
install:
- requirements: doc/requirements.pip
- - method: pip
- path: .
- system_packages: false
diff --git a/tox.ini b/tox.ini
index af0ffe726..967505487 100644
--- a/tox.ini
+++ b/tox.ini
@@ -58,7 +58,7 @@ basepython = {env:COVERAGE_ANYPY}
# One of the PYVERSIONS, that's currently supported by Sphinx. Make sure it
# matches the `python:version:` in the .readthedocs.yml file, and the
# python-version in the `doc` job in the .github/workflows/quality.yml workflow.
-basepython = python3.8
+basepython = python3.11
# Build the docs so we know if they are successful. We build twice: once with
# -q to get all warnings, and once with -QW to get a success/fail status
From 9d9681ee851c28b9d9b2f3daf16390d5fab5af54 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 1 Jun 2023 06:21:14 -0400
Subject: [PATCH 13/83] chore: make upgrade
---
requirements/dev.pip | 4 ++--
requirements/lint.pip | 4 ++--
requirements/mypy.pip | 2 +-
requirements/pytest.pip | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/requirements/dev.pip b/requirements/dev.pip
index 3d9414583..fc49f5ebc 100644
--- a/requirements/dev.pip
+++ b/requirements/dev.pip
@@ -49,7 +49,7 @@ flaky==3.7.0
# via -r requirements/pytest.in
greenlet==2.0.2
# via -r requirements/dev.in
-hypothesis==6.75.7
+hypothesis==6.75.9
# via -r requirements/pytest.in
idna==3.4
# via requests
@@ -139,7 +139,7 @@ requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
-rich==13.3.5
+rich==13.4.1
# via twine
six==1.16.0
# via bleach
diff --git a/requirements/lint.pip b/requirements/lint.pip
index 9c5d9f79a..e449e44cf 100644
--- a/requirements/lint.pip
+++ b/requirements/lint.pip
@@ -67,7 +67,7 @@ flaky==3.7.0
# via -r requirements/pytest.in
greenlet==2.0.2
# via -r requirements/dev.in
-hypothesis==6.75.7
+hypothesis==6.75.9
# via -r requirements/pytest.in
idna==3.4
# via requests
@@ -175,7 +175,7 @@ requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
-rich==13.3.5
+rich==13.4.1
# via twine
scriv==1.3.1
# via -r doc/requirements.in
diff --git a/requirements/mypy.pip b/requirements/mypy.pip
index a019d96fc..fc34dc2c7 100644
--- a/requirements/mypy.pip
+++ b/requirements/mypy.pip
@@ -16,7 +16,7 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.7
+hypothesis==6.75.9
# via -r requirements/pytest.in
importlib-metadata==6.6.0
# via
diff --git a/requirements/pytest.pip b/requirements/pytest.pip
index 92fb30b9a..7ee500449 100644
--- a/requirements/pytest.pip
+++ b/requirements/pytest.pip
@@ -16,7 +16,7 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.7
+hypothesis==6.75.9
# via -r requirements/pytest.in
importlib-metadata==6.6.0
# via
From 17a522584111a050d2a49aa125c08802b4a09985 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 1 Jun 2023 06:24:21 -0400
Subject: [PATCH 14/83] chore: make docs_upgrade
---
doc/requirements.pip | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/doc/requirements.pip b/doc/requirements.pip
index 5b84f03cd..914d07866 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.8
+# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# make doc_upgrade
@@ -32,8 +32,6 @@ idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
-importlib-metadata==6.6.0
- # via sphinx
jinja2==3.1.2
# via
# scriv
@@ -46,8 +44,6 @@ packaging==23.1
# via sphinx
pygments==2.15.1
# via sphinx
-pytz==2023.3
- # via babel
requests==2.31.0
# via
# scriv
@@ -92,5 +88,3 @@ tornado==6.3.2
# via livereload
urllib3==2.0.2
# via requests
-zipp==3.15.0
- # via importlib-metadata
From 7e56dfb5fdbe78b0fc4de5acabceefd5ec031f6e Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 1 Jun 2023 06:43:59 -0400
Subject: [PATCH 15/83] build: we can use doc8 again
---
doc/requirements.in | 2 +-
doc/requirements.pip | 14 +++++++++++++-
requirements/lint.pip | 12 ++++++++++++
tox.ini | 6 +++---
4 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/doc/requirements.in b/doc/requirements.in
index 6d1bd330f..a6510c6ec 100644
--- a/doc/requirements.in
+++ b/doc/requirements.in
@@ -7,6 +7,7 @@
-c ../requirements/pins.pip
cogapp
+doc8
scriv # for writing GitHub releases
sphinx
sphinx-autobuild
@@ -15,6 +16,5 @@ sphinx-code-tabs
sphinxcontrib-restbuilder
# These aren't compatible atm with other library versions:
-#doc8
#pyenchant
#sphinxcontrib-spelling
diff --git a/doc/requirements.pip b/doc/requirements.pip
index 914d07866..09eccca44 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -24,8 +24,12 @@ cogapp==3.3.0
# via -r doc/requirements.in
colorama==0.4.6
# via sphinx-autobuild
+doc8==0.11.2
+ # via -r doc/requirements.in
docutils==0.18.1
# via
+ # doc8
+ # restructuredtext-lint
# sphinx
# sphinx-rtd-theme
idna==3.4
@@ -42,12 +46,18 @@ markupsafe==2.1.2
# via jinja2
packaging==23.1
# via sphinx
+pbr==5.11.1
+ # via stevedore
pygments==2.15.1
- # via sphinx
+ # via
+ # doc8
+ # sphinx
requests==2.31.0
# via
# scriv
# sphinx
+restructuredtext-lint==1.4.0
+ # via doc8
scriv==1.3.1
# via -r doc/requirements.in
six==1.16.0
@@ -84,6 +94,8 @@ sphinxcontrib-restbuilder==0.3
# via -r doc/requirements.in
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
+stevedore==5.1.0
+ # via doc8
tornado==6.3.2
# via livereload
urllib3==2.0.2
diff --git a/requirements/lint.pip b/requirements/lint.pip
index e449e44cf..40deeb1f9 100644
--- a/requirements/lint.pip
+++ b/requirements/lint.pip
@@ -48,9 +48,13 @@ dill==0.3.6
# via pylint
distlib==0.3.6
# via virtualenv
+doc8==0.11.2
+ # via -r doc/requirements.in
docutils==0.18.1
# via
+ # doc8
# readme-renderer
+ # restructuredtext-lint
# sphinx
# sphinx-rtd-theme
exceptiongroup==1.1.1
@@ -82,6 +86,7 @@ importlib-metadata==6.6.0
# pluggy
# pytest
# sphinx
+ # stevedore
# tox
# twine
# virtualenv
@@ -127,6 +132,8 @@ packaging==23.1
# tox
parso==0.8.3
# via jedi
+pbr==5.11.1
+ # via stevedore
pkginfo==1.9.6
# via twine
platformdirs==3.5.1
@@ -142,6 +149,7 @@ pudb==2022.1.3
# via -r requirements/dev.in
pygments==2.15.1
# via
+ # doc8
# pudb
# readme-renderer
# rich
@@ -173,6 +181,8 @@ requests==2.31.0
# twine
requests-toolbelt==1.0.0
# via twine
+restructuredtext-lint==1.4.0
+ # via doc8
rfc3986==2.0.0
# via twine
rich==13.4.1
@@ -218,6 +228,8 @@ sphinxcontrib-restbuilder==0.3
# via -r doc/requirements.in
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
+stevedore==3.5.2
+ # via doc8
tomli==2.0.1
# via
# build
diff --git a/tox.ini b/tox.ini
index 967505487..c08367f4b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -70,7 +70,7 @@ allowlist_externals =
commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
- ;doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
+ doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
sphinx-build -b html -aEnqW doc doc/_build/html
rst2html.py --strict README.rst doc/_build/trash
- sphinx-build -b html -b linkcheck -aEnq doc doc/_build/html
@@ -91,8 +91,8 @@ commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
python -m cogapp -cP --check --verbosity=1 .github/workflows/*.yml
- ;doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
- python -m pylint --notes= {env:LINTABLE}
+ doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
+ python -m pylint --notes= --ignore-paths 'doc/_build/.*' {env:LINTABLE}
check-manifest --ignore 'doc/sample_html/*,.treerc'
# If 'build -q' becomes a thing (https://github.com/pypa/build/issues/188),
# this can be simplified:
From 3f103ce01c9ff5fff9c654a20bf268fe49cb46a4 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 1 Jun 2023 06:52:37 -0400
Subject: [PATCH 16/83] build: avoid doc tooling in the lint step
---
Makefile | 1 -
requirements/lint.pip | 294 ------------------------------------------
tox.ini | 3 +-
3 files changed, 1 insertion(+), 297 deletions(-)
delete mode 100644 requirements/lint.pip
diff --git a/Makefile b/Makefile
index 37790bf5d..3ccb7e76b 100644
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,6 @@ upgrade: ## Update the *.pip files with the latest packages satisfying *.in
$(PIP_COMPILE) -o requirements/tox.pip requirements/tox.in
$(PIP_COMPILE) -o requirements/dev.pip requirements/dev.in
$(PIP_COMPILE) -o requirements/light-threads.pip requirements/light-threads.in
- $(PIP_COMPILE) -o requirements/lint.pip doc/requirements.in requirements/dev.in
$(PIP_COMPILE) -o requirements/mypy.pip requirements/mypy.in
doc_upgrade: export CUSTOM_COMPILE_COMMAND=make doc_upgrade
diff --git a/requirements/lint.pip b/requirements/lint.pip
deleted file mode 100644
index 40deeb1f9..000000000
--- a/requirements/lint.pip
+++ /dev/null
@@ -1,294 +0,0 @@
-#
-# This file is autogenerated by pip-compile with Python 3.7
-# by the following command:
-#
-# make upgrade
-#
-alabaster==0.7.13
- # via sphinx
-astroid==2.15.5
- # via pylint
-attrs==23.1.0
- # via
- # hypothesis
- # scriv
-babel==2.12.1
- # via sphinx
-bleach==6.0.0
- # via readme-renderer
-build==0.10.0
- # via check-manifest
-cachetools==5.3.1
- # via tox
-certifi==2023.5.7
- # via requests
-chardet==5.1.0
- # via tox
-charset-normalizer==3.1.0
- # via requests
-check-manifest==0.49
- # via -r requirements/dev.in
-click==8.1.3
- # via
- # click-log
- # scriv
-click-log==0.4.0
- # via scriv
-cogapp==3.3.0
- # via
- # -r doc/requirements.in
- # -r requirements/dev.in
-colorama==0.4.6
- # via
- # -r requirements/pytest.in
- # -r requirements/tox.in
- # sphinx-autobuild
- # tox
-dill==0.3.6
- # via pylint
-distlib==0.3.6
- # via virtualenv
-doc8==0.11.2
- # via -r doc/requirements.in
-docutils==0.18.1
- # via
- # doc8
- # readme-renderer
- # restructuredtext-lint
- # sphinx
- # sphinx-rtd-theme
-exceptiongroup==1.1.1
- # via
- # hypothesis
- # pytest
-execnet==1.9.0
- # via pytest-xdist
-filelock==3.12.0
- # via
- # tox
- # virtualenv
-flaky==3.7.0
- # via -r requirements/pytest.in
-greenlet==2.0.2
- # via -r requirements/dev.in
-hypothesis==6.75.9
- # via -r requirements/pytest.in
-idna==3.4
- # via requests
-imagesize==1.4.1
- # via sphinx
-importlib-metadata==6.6.0
- # via
- # attrs
- # build
- # click
- # keyring
- # pluggy
- # pytest
- # sphinx
- # stevedore
- # tox
- # twine
- # virtualenv
-importlib-resources==5.12.0
- # via keyring
-iniconfig==2.0.0
- # via pytest
-isort==5.11.5
- # via pylint
-jaraco-classes==3.2.3
- # via keyring
-jedi==0.18.2
- # via pudb
-jinja2==3.1.2
- # via
- # scriv
- # sphinx
-keyring==23.13.1
- # via twine
-lazy-object-proxy==1.9.0
- # via astroid
-libsass==0.22.0
- # via -r requirements/dev.in
-livereload==2.6.3
- # via sphinx-autobuild
-markdown-it-py==2.2.0
- # via rich
-markupsafe==2.1.2
- # via jinja2
-mccabe==0.7.0
- # via pylint
-mdurl==0.1.2
- # via markdown-it-py
-more-itertools==9.1.0
- # via jaraco-classes
-packaging==23.1
- # via
- # build
- # pudb
- # pyproject-api
- # pytest
- # sphinx
- # tox
-parso==0.8.3
- # via jedi
-pbr==5.11.1
- # via stevedore
-pkginfo==1.9.6
- # via twine
-platformdirs==3.5.1
- # via
- # pylint
- # tox
- # virtualenv
-pluggy==1.0.0
- # via
- # pytest
- # tox
-pudb==2022.1.3
- # via -r requirements/dev.in
-pygments==2.15.1
- # via
- # doc8
- # pudb
- # readme-renderer
- # rich
- # sphinx
-pylint==2.17.4
- # via -r requirements/dev.in
-pyproject-api==1.5.1
- # via tox
-pyproject-hooks==1.0.0
- # via build
-pytest==7.3.1
- # via
- # -r requirements/pytest.in
- # pytest-xdist
-pytest-xdist==3.3.1
- # via -r requirements/pytest.in
-pytz==2023.3
- # via babel
-readme-renderer==37.3
- # via
- # -r requirements/dev.in
- # twine
-requests==2.31.0
- # via
- # -r requirements/dev.in
- # requests-toolbelt
- # scriv
- # sphinx
- # twine
-requests-toolbelt==1.0.0
- # via twine
-restructuredtext-lint==1.4.0
- # via doc8
-rfc3986==2.0.0
- # via twine
-rich==13.4.1
- # via twine
-scriv==1.3.1
- # via -r doc/requirements.in
-six==1.16.0
- # via
- # bleach
- # livereload
-snowballstemmer==2.2.0
- # via sphinx
-sortedcontainers==2.4.0
- # via hypothesis
-sphinx==5.3.0
- # via
- # -c requirements/pins.pip
- # -r doc/requirements.in
- # sphinx-autobuild
- # sphinx-code-tabs
- # sphinx-rtd-theme
- # sphinxcontrib-jquery
- # sphinxcontrib-restbuilder
-sphinx-autobuild==2021.3.14
- # via -r doc/requirements.in
-sphinx-code-tabs==0.5.3
- # via -r doc/requirements.in
-sphinx-rtd-theme==1.2.1
- # via -r doc/requirements.in
-sphinxcontrib-applehelp==1.0.2
- # via sphinx
-sphinxcontrib-devhelp==1.0.2
- # via sphinx
-sphinxcontrib-htmlhelp==2.0.0
- # via sphinx
-sphinxcontrib-jquery==4.1
- # via sphinx-rtd-theme
-sphinxcontrib-jsmath==1.0.1
- # via sphinx
-sphinxcontrib-qthelp==1.0.3
- # via sphinx
-sphinxcontrib-restbuilder==0.3
- # via -r doc/requirements.in
-sphinxcontrib-serializinghtml==1.1.5
- # via sphinx
-stevedore==3.5.2
- # via doc8
-tomli==2.0.1
- # via
- # build
- # check-manifest
- # pylint
- # pyproject-api
- # pyproject-hooks
- # pytest
- # tox
-tomlkit==0.11.8
- # via pylint
-tornado==6.2
- # via livereload
-tox==4.5.2
- # via
- # -r requirements/tox.in
- # tox-gh
-tox-gh==1.0.0
- # via -r requirements/tox.in
-twine==4.0.2
- # via -r requirements/dev.in
-typed-ast==1.5.4
- # via astroid
-typing-extensions==4.6.2
- # via
- # astroid
- # importlib-metadata
- # markdown-it-py
- # platformdirs
- # pylint
- # rich
- # tox
-urllib3==2.0.2
- # via
- # requests
- # twine
-urwid==2.1.2
- # via
- # pudb
- # urwid-readline
-urwid-readline==0.13
- # via pudb
-virtualenv==20.23.0
- # via
- # -r requirements/pip.in
- # tox
-webencodings==0.5.1
- # via bleach
-wrapt==1.15.0
- # via astroid
-zipp==3.15.0
- # via
- # importlib-metadata
- # importlib-resources
-
-# The following packages are considered to be unsafe in a requirements file:
-pip==23.1.2
- # via -r requirements/pip.in
-setuptools==67.8.0
- # via
- # -r requirements/pip.in
- # check-manifest
diff --git a/tox.ini b/tox.ini
index c08367f4b..533dc275f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -80,7 +80,7 @@ commands =
# Minimum of PYVERSIONS
basepython = python3.7
deps =
- -r requirements/lint.pip
+ -r requirements/dev.pip
setenv =
{[testenv]setenv}
@@ -91,7 +91,6 @@ commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
python -m cogapp -cP --check --verbosity=1 .github/workflows/*.yml
- doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
python -m pylint --notes= --ignore-paths 'doc/_build/.*' {env:LINTABLE}
check-manifest --ignore 'doc/sample_html/*,.treerc'
# If 'build -q' becomes a thing (https://github.com/pypa/build/issues/188),
From 54248b99a9bd04b522da1c0683754898dfae2536 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 3 Jun 2023 06:55:28 -0400
Subject: [PATCH 17/83] build: deadsnakes dropped 3.10
---
.github/workflows/python-nightly.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index 319064c94..431c37143 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -37,6 +37,7 @@ jobs:
# because jammy ships 3.10, and deadsnakes doesn't want to clobber it.
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages
# https://github.com/deadsnakes/issues/issues/234
+ # bionic: 18, focal: 20, jammy: 22
runs-on: ubuntu-20.04
strategy:
@@ -46,7 +47,6 @@ jobs:
# tox.ini so that tox will run properly. PYVERSIONS
# Available versions:
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages
- - "3.10-dev"
- "3.11-dev"
- "3.12-dev"
# https://github.com/actions/setup-python#available-versions-of-pypy
From a8da60958336a7a3761f999b7cb8fcc2bd7fada5 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 4 Jun 2023 10:40:50 -0400
Subject: [PATCH 18/83] docs: multi-syntax config examples
---
doc/_static/coverage.css | 4 +
doc/cog_helpers.py | 69 +++++++++++++++
doc/config.rst | 177 ++++++++++++++++++++++++++++++++++-----
3 files changed, 229 insertions(+), 21 deletions(-)
create mode 100644 doc/cog_helpers.py
diff --git a/doc/_static/coverage.css b/doc/_static/coverage.css
index 5dd8961a6..ee5349910 100644
--- a/doc/_static/coverage.css
+++ b/doc/_static/coverage.css
@@ -101,3 +101,7 @@ div.tab.selected {
border: 1px solid #ccc;
border-radius: 0 .5em .5em .5em;
}
+
+div.tab.codetab.selected {
+ border: none;
+}
diff --git a/doc/cog_helpers.py b/doc/cog_helpers.py
new file mode 100644
index 000000000..98cc284c8
--- /dev/null
+++ b/doc/cog_helpers.py
@@ -0,0 +1,69 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+
+"""
+Functions for use with cog in the documentation.
+"""
+
+import os
+import re
+import textwrap
+
+import cog # pylint: disable=import-error
+
+from coverage.config import read_coverage_config
+
+def _read_config(text, fname):
+ """
+ Prep and read configuration text.
+
+ Returns the prepared text, and a dict of the settings.
+ """
+ # Text will be triple-quoted with an initial ignored newline.
+ assert text[0] == "\n"
+ text = textwrap.dedent(text[1:])
+
+ os.makedirs("tmp", exist_ok=True)
+ with open(f"tmp/{fname}", "w") as f:
+ f.write(text)
+
+ config = read_coverage_config(f"tmp/{fname}", warn=cog.error)
+
+ values = {}
+ for name, val in vars(config).items():
+ if name.startswith("_"):
+ continue
+ if "config_file" in name:
+ continue
+ values[name] = val
+ return text, values
+
+
+def show_configs(rc, toml):
+ """
+ Show configuration text in a tabbed box.
+
+ `rc` is the ini-file syntax, `toml` is the equivalent TOML syntax.
+ The equivalence is checked for accuracy, and the process fails if there's
+ a mismtach.
+
+ A three-tabbed box will be produced.
+ """
+ rc, rc_vals = _read_config(rc, "covrc")
+ toml, toml_vals = _read_config(toml, "covrc.toml")
+ for key, val in rc_vals.items():
+ if val != toml_vals[key]:
+ cog.error(f"Mismatch! {key}: {val!r} vs {toml_vals[key]!r}")
+
+ ini = re.sub(r"(?m)^\[", "[coverage:", rc)
+ print()
+ print(".. tabs::\n")
+ for name, syntax, text in [
+ (".coveragerc", "ini", rc),
+ ("pyproject.toml", "toml", toml),
+ ("setup.cfg, tox.ini", "ini", ini),
+ ]:
+ print(f" .. code-tab:: {syntax}")
+ print(f" :caption: {name}")
+ print()
+ print(textwrap.indent(text, " " * 8))
diff --git a/doc/config.rst b/doc/config.rst
index 0100d89e1..9a67a0df0 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -1,6 +1,16 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. This file is processed with cog to create the tabbed multi-syntax
+ configuration examples. If those are wrong, the quality checks will fail.
+ Running "make prebuild" checks them and produces the output.
+
+.. [[[cog
+ from cog_helpers import show_configs
+.. ]]]
+.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
+
+
.. _config:
=======================
@@ -71,34 +81,159 @@ control what happens if the variable isn't defined in the environment:
Many sections and settings correspond roughly to commands and options in
the :ref:`command-line interface `.
-Here's a sample configuration file::
+Here's a sample configuration file:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [run]
+ branch = True
+
+ [report]
+ ; Regexes for lines to exclude from consideration
+ exclude_also =
+ ; Don't complain about missing debug-only code:
+ def __repr__
+ if self\.debug
+
+ ; Don't complain if tests don't hit defensive assertion code:
+ raise AssertionError
+ raise NotImplementedError
+
+ ; Don't complain if non-runnable code isn't run:
+ if 0:
+ if __name__ == .__main__.:
+
+ ; Don't complain about abstract methods, they aren't run:
+ @(abc\.)?abstractmethod
+
+ ignore_errors = True
+
+ [html]
+ directory = coverage_html_report
+ """,
+ toml=r"""
+ [tool.coverage.run]
+ branch = true
+
+ [tool.coverage.report]
+ # Regexes for lines to exclude from consideration
+ exclude_also = [
+ # Don't complain about missing debug-only code:
+ "def __repr__",
+ "if self\\.debug",
+
+ # Don't complain if tests don't hit defensive assertion code:
+ "raise AssertionError",
+ "raise NotImplementedError",
+
+ # Don't complain if non-runnable code isn't run:
+ "if 0:",
+ "if __name__ == .__main__.:",
+
+ # Don't complain about abstract methods, they aren't run:
+ "@(abc\\.)?abstractmethod",
+ ]
+
+ ignore_errors = true
+
+ [tool.coverage.html]
+ directory = "coverage_html_report"
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [run]
+ branch = True
+
+ [report]
+ ; Regexes for lines to exclude from consideration
+ exclude_also =
+ ; Don't complain about missing debug-only code:
+ def __repr__
+ if self\.debug
+
+ ; Don't complain if tests don't hit defensive assertion code:
+ raise AssertionError
+ raise NotImplementedError
+
+ ; Don't complain if non-runnable code isn't run:
+ if 0:
+ if __name__ == .__main__.:
+
+ ; Don't complain about abstract methods, they aren't run:
+ @(abc\.)?abstractmethod
+
+ ignore_errors = True
+
+ [html]
+ directory = coverage_html_report
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.run]
+ branch = true
+
+ [tool.coverage.report]
+ # Regexes for lines to exclude from consideration
+ exclude_also = [
+ # Don't complain about missing debug-only code:
+ "def __repr__",
+ "if self\\.debug",
+
+ # Don't complain if tests don't hit defensive assertion code:
+ "raise AssertionError",
+ "raise NotImplementedError",
+
+ # Don't complain if non-runnable code isn't run:
+ "if 0:",
+ "if __name__ == .__main__.:",
+
+ # Don't complain about abstract methods, they aren't run:
+ "@(abc\\.)?abstractmethod",
+ ]
+
+ ignore_errors = true
+
+ [tool.coverage.html]
+ directory = "coverage_html_report"
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:run]
+ branch = True
- # .coveragerc to control coverage.py
- [run]
- branch = True
+ [coverage:report]
+ ; Regexes for lines to exclude from consideration
+ exclude_also =
+ ; Don't complain about missing debug-only code:
+ def __repr__
+ if self\.debug
- [report]
- # Regexes for lines to exclude from consideration
- exclude_also =
- # Don't complain about missing debug-only code:
- def __repr__
- if self\.debug
+ ; Don't complain if tests don't hit defensive assertion code:
+ raise AssertionError
+ raise NotImplementedError
- # Don't complain if tests don't hit defensive assertion code:
- raise AssertionError
- raise NotImplementedError
+ ; Don't complain if non-runnable code isn't run:
+ if 0:
+ if __name__ == .__main__.:
- # Don't complain if non-runnable code isn't run:
- if 0:
- if __name__ == .__main__.:
+ ; Don't complain about abstract methods, they aren't run:
+ @(abc\.)?abstractmethod
- # Don't complain about abstract methods, they aren't run:
- @(abc\.)?abstractmethod
+ ignore_errors = True
- ignore_errors = True
+ [coverage:html]
+ directory = coverage_html_report
- [html]
- directory = coverage_html_report
+.. [[[end]]] (checksum: 75c6c0c2ee170424cc1c18710e2b4919)
.. _config_run:
From c7685f97e0c34bfad2e7998e9d71afca726b0a6d Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 4 Jun 2023 11:29:04 -0400
Subject: [PATCH 19/83] refactor(docs): move other cog code into cog_helpers.py
---
doc/cmd.rst | 26 ++------------------------
doc/cog_helpers.py | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/doc/cmd.rst b/doc/cmd.rst
index 7db6746a8..76f8d7793 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -1,34 +1,12 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
-.. This file is meant to be processed with cog to insert the latest command
+.. This file is processed with cog to insert the latest command
help into the docs. If it's out of date, the quality checks will fail.
Running "make prebuild" will bring it up to date.
.. [[[cog
- # optparse wraps help to the COLUMNS value. Set it here to be sure it's
- # consistent regardless of the environment. Has to be set before we
- # import cmdline.py, which creates the optparse objects.
- import os
- os.environ["COLUMNS"] = "80"
-
- import contextlib
- import io
- import re
- import textwrap
- from coverage.cmdline import CoverageScript
-
- def show_help(cmd):
- with contextlib.redirect_stdout(io.StringIO()) as stdout:
- CoverageScript().command_line([cmd, "--help"])
- help = stdout.getvalue()
- help = help.replace("__main__.py", "coverage")
- help = re.sub(r"(?m)^Full doc.*$", "", help)
- help = help.rstrip()
-
- print(".. code::\n")
- print(f" $ coverage {cmd} --help")
- print(textwrap.indent(help, " "))
+ from cog_helpers import show_help
.. ]]]
.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
diff --git a/doc/cog_helpers.py b/doc/cog_helpers.py
index 98cc284c8..94c914f54 100644
--- a/doc/cog_helpers.py
+++ b/doc/cog_helpers.py
@@ -5,14 +5,42 @@
Functions for use with cog in the documentation.
"""
+# For help text in doc/cmd.rst:
+# optparse wraps help to the COLUMNS value. Set it here to be sure it's
+# consistent regardless of the environment. Has to be set before we
+# import cmdline.py, which creates the optparse objects.
+
+# pylint: disable=wrong-import-position
import os
+os.environ["COLUMNS"] = "80"
+
+import contextlib
+import io
import re
import textwrap
import cog # pylint: disable=import-error
+from coverage.cmdline import CoverageScript
from coverage.config import read_coverage_config
+
+def show_help(cmd):
+ """
+ Insert the help output from a command.
+ """
+ with contextlib.redirect_stdout(io.StringIO()) as stdout:
+ CoverageScript().command_line([cmd, "--help"])
+ help_text = stdout.getvalue()
+ help_text = help_text.replace("__main__.py", "coverage")
+ help_text = re.sub(r"(?m)^Full doc.*$", "", help_text)
+ help_text = help_text.rstrip()
+
+ print(".. code::\n")
+ print(f" $ coverage {cmd} --help")
+ print(textwrap.indent(help_text, " "))
+
+
def _read_config(text, fname):
"""
Prep and read configuration text.
From c0a2d714ea7930e1ba5c7c8c11afe1faab5c04ea Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 4 Jun 2023 12:27:10 -0400
Subject: [PATCH 20/83] test: include a test of [paths] in .toml
---
tests/test_config.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/test_config.py b/tests/test_config.py
index 6739a426f..5c2bb3bb0 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -322,6 +322,12 @@ def test_tilde_in_toml_config(self) -> None:
"~/data.file",
"~joe/html_dir",
]
+
+ [tool.coverage.paths]
+ mapping = [
+ "~/src",
+ "~joe/source",
+ ]
""")
def expanduser(s: str) -> str:
"""Fake tilde expansion"""
@@ -335,6 +341,7 @@ def expanduser(s: str) -> str:
assert cov.config.html_dir == "/Users/joe/html_dir"
assert cov.config.xml_output == "/Users/me/somewhere/xml.out"
assert cov.config.exclude_list == ["~/data.file", "~joe/html_dir"]
+ assert cov.config.paths == {'mapping': ['/Users/me/src', '/Users/joe/source']}
def test_tweaks_after_constructor(self) -> None:
# set_option can be used after construction to affect the config.
From dccec3eff47ef405b24a9dad38fab407c624e542 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 4 Jun 2023 12:45:07 -0400
Subject: [PATCH 21/83] docs: convert most config examples to multi-config
---
CHANGES.rst | 3 +
doc/cmd.rst | 41 ++++++++++--
doc/config.rst | 59 +++++++++++++++--
doc/contexts.rst | 48 +++++++++++++-
doc/excluding.rst | 162 ++++++++++++++++++++++++++++++++++++++++------
doc/plugins.rst | 94 ++++++++++++++++++++++++---
doc/source.rst | 88 ++++++++++++++++++++++---
7 files changed, 440 insertions(+), 55 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index a066a68f0..bd83dce25 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -38,6 +38,9 @@ Version 7.2.7 — 2023-05-29
recent change (`issue 1538`_). Thanks to `Anders Kaseorg `_
and David Szotten for persisting with problem reports and detailed diagnoses.
+- Docs: examples of configuration files now include separate examples for the
+ different syntaxes: .coveragerc, pyproject.toml, setup.cfg, and tox.ini.
+
- Wheels are now provided for CPython 3.12.
.. _issue 1586: https://github.com/nedbat/coveragepy/issues/1586
diff --git a/doc/cmd.rst b/doc/cmd.rst
index 76f8d7793..366614734 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -6,7 +6,7 @@
Running "make prebuild" will bring it up to date.
.. [[[cog
- from cog_helpers import show_help
+ from cog_helpers import show_configs, show_help
.. ]]]
.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
@@ -271,15 +271,42 @@ Conflicting dynamic contexts (dynamic-conflict)
Individual warnings can be disabled with the :ref:`disable_warnings
` configuration setting. To silence "No data was
-collected," add this to your .coveragerc file::
+collected," add this to your configuration file:
- [run]
- disable_warnings = no-data-collected
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [run]
+ disable_warnings = no-data-collected
+ """,
+ toml=r"""
+ [tool.coverage.run]
+ disable_warnings = ["no-data-collected"]
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [run]
+ disable_warnings = no-data-collected
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.run]
+ disable_warnings = ["no-data-collected"]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
-or pyproject.toml::
+ [coverage:run]
+ disable_warnings = no-data-collected
- [tool.coverage.run]
- disable_warnings = ['no-data-collected']
+.. [[[end]]] (checksum: 66c0c28e863c2a44218190a8a6a3f707)
.. _cmd_datafile:
diff --git a/doc/config.rst b/doc/config.rst
index 9a67a0df0..78fc58a05 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -462,13 +462,60 @@ Try this if you get seemingly impossible results.
-------
The entries in this section are lists of file paths that should be considered
-equivalent when combining data from different machines::
+equivalent when combining data from different machines:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [paths]
+ source =
+ src/
+ /jenkins/build/*/src
+ c:\myproj\src
+ """,
+ toml=r"""
+ [tool.coverage.paths]
+ source = [
+ "src/",
+ "/jenkins/build/*/src",
+ "c:\\myproj\\src",
+ ]
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [paths]
+ source =
+ src/
+ /jenkins/build/*/src
+ c:\myproj\src
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.paths]
+ source = [
+ "src/",
+ "/jenkins/build/*/src",
+ "c:\\myproj\\src",
+ ]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:paths]
+ source =
+ src/
+ /jenkins/build/*/src
+ c:\myproj\src
+
+.. [[[end]]] (checksum: cf06ac36436db0c87be15a85223900d0)
- [paths]
- source =
- src/
- /jenkins/build/*/src
- c:\myproj\src
The names of the entries ("source" in this example) are ignored, you may choose
any name that you like. The value is a list of strings. When combining data
diff --git a/doc/contexts.rst b/doc/contexts.rst
index fbf940405..686b762be 100644
--- a/doc/contexts.rst
+++ b/doc/contexts.rst
@@ -1,6 +1,16 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. This file is processed with cog to create the tabbed multi-syntax
+ configuration examples. If those are wrong, the quality checks will fail.
+ Running "make prebuild" checks them and produces the output.
+
+.. [[[cog
+ from cog_helpers import show_configs
+.. ]]]
+.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
+
+
.. _contexts:
====================
@@ -63,10 +73,42 @@ There are three ways to enable dynamic contexts:
.. highlight:: ini
The ``[run] dynamic_context`` setting has only one option now. Set it to
-``test_function`` to start a new dynamic context for every test function::
+``test_function`` to start a new dynamic context for every test function:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [run]
+ dynamic_context = test_function
+ """,
+ toml=r"""
+ [tool.coverage.run]
+ dynamic_context = "test_function"
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [run]
+ dynamic_context = test_function
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.run]
+ dynamic_context = "test_function"
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:run]
+ dynamic_context = test_function
- [run]
- dynamic_context = test_function
+.. [[[end]]] (checksum: 5c5d120ee876e5fe26e573e1a5e8551d)
Each test function you run will be considered a separate dynamic context, and
coverage data will be segregated for each. A test function is any function
diff --git a/doc/excluding.rst b/doc/excluding.rst
index e9d28f156..a45e57f2a 100644
--- a/doc/excluding.rst
+++ b/doc/excluding.rst
@@ -1,6 +1,16 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. This file is processed with cog to create the tabbed multi-syntax
+ configuration examples. If those are wrong, the quality checks will fail.
+ Running "make prebuild" checks them and produces the output.
+
+.. [[[cog
+ from cog_helpers import show_configs
+.. ]]]
+.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
+
+
.. _excluding:
===============================
@@ -77,26 +87,138 @@ function.
For example, you might decide that __repr__ functions are usually only used in
debugging code, and are uninteresting to test themselves. You could exclude
-all of them by adding a regex to the exclusion list::
-
- [report]
- exclude_also =
- def __repr__
-
-For example, here's a list of exclusions I've used::
-
- [report]
- exclude_also =
- def __repr__
- if self.debug:
- if settings.DEBUG
- raise AssertionError
- raise NotImplementedError
- if 0:
- if __name__ == .__main__.:
- if TYPE_CHECKING:
- class .*\bProtocol\):
- @(abc\.)?abstractmethod
+all of them by adding a regex to the exclusion list:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [report]
+ exclude_also =
+ def __repr__
+ """,
+ toml=r"""
+ [tool.coverage.report]
+ exclude_also = [
+ "def __repr__",
+ ]
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [report]
+ exclude_also =
+ def __repr__
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.report]
+ exclude_also = [
+ "def __repr__",
+ ]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:report]
+ exclude_also =
+ def __repr__
+
+.. [[[end]]] (checksum: adc6406467518c89a5a6fe2c4b999416)
+
+For example, here's a list of exclusions I've used:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [report]
+ exclude_also =
+ def __repr__
+ if self.debug:
+ if settings.DEBUG
+ raise AssertionError
+ raise NotImplementedError
+ if 0:
+ if __name__ == .__main__.:
+ if TYPE_CHECKING:
+ class .*\bProtocol\):
+ @(abc\.)?abstractmethod
+ """,
+ toml=r"""
+ [tool.coverage.report]
+ exclude_also = [
+ "def __repr__",
+ "if self.debug:",
+ "if settings.DEBUG",
+ "raise AssertionError",
+ "raise NotImplementedError",
+ "if 0:",
+ "if __name__ == .__main__.:",
+ "if TYPE_CHECKING:",
+ "class .*\\bProtocol\\):",
+ "@(abc\\.)?abstractmethod",
+ ]
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [report]
+ exclude_also =
+ def __repr__
+ if self.debug:
+ if settings.DEBUG
+ raise AssertionError
+ raise NotImplementedError
+ if 0:
+ if __name__ == .__main__.:
+ if TYPE_CHECKING:
+ class .*\bProtocol\):
+ @(abc\.)?abstractmethod
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.report]
+ exclude_also = [
+ "def __repr__",
+ "if self.debug:",
+ "if settings.DEBUG",
+ "raise AssertionError",
+ "raise NotImplementedError",
+ "if 0:",
+ "if __name__ == .__main__.:",
+ "if TYPE_CHECKING:",
+ "class .*\\bProtocol\\):",
+ "@(abc\\.)?abstractmethod",
+ ]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:report]
+ exclude_also =
+ def __repr__
+ if self.debug:
+ if settings.DEBUG
+ raise AssertionError
+ raise NotImplementedError
+ if 0:
+ if __name__ == .__main__.:
+ if TYPE_CHECKING:
+ class .*\bProtocol\):
+ @(abc\.)?abstractmethod
+
+.. [[[end]]] (checksum: ef1947821b8224c4f02d27f9514e5c5e)
The :ref:`config_report_exclude_also` option adds regexes to the built-in
default list so that you can add your own exclusions. The older
diff --git a/doc/plugins.rst b/doc/plugins.rst
index a289ba7e6..23034d0db 100644
--- a/doc/plugins.rst
+++ b/doc/plugins.rst
@@ -1,6 +1,16 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. This file is processed with cog to create the tabbed multi-syntax
+ configuration examples. If those are wrong, the quality checks will fail.
+ Running "make prebuild" checks them and produces the output.
+
+.. [[[cog
+ from cog_helpers import show_configs
+.. ]]]
+.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
+
+
.. _plugins:
========
@@ -36,20 +46,86 @@ a coverage.py plug-in called ``something.plugin``.
``plugins`` setting indicates your plug-in. It's a list of importable
module names of plug-ins:
- .. code-block:: ini
+ .. [[[cog
+ show_configs(
+ rc=r"""
+ [run]
+ plugins =
+ something.plugin
+ """,
+ toml=r"""
+ [tool.coverage.run]
+ plugins = [ "something.plugin" ]
+ """,
+ )
+ .. ]]]
+
+ .. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [run]
+ plugins =
+ something.plugin
- [run]
- plugins =
- something.plugin
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.run]
+ plugins = [ "something.plugin" ]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:run]
+ plugins =
+ something.plugin
+
+ .. [[[end]]] (checksum: 788b15abb3c53370ccae3d9348e65385)
#. If the plug-in needs its own configuration, you can add those settings in
the .coveragerc file in a section named for the plug-in:
- .. code-block:: ini
-
- [something.plugin]
- option1 = True
- option2 = abc.foo
+ .. [[[cog
+ show_configs(
+ rc=r"""
+ [something.plugin]
+ option1 = True
+ option2 = abc.foo
+ """,
+ toml=r"""
+ [tool.coverage.something.plugin]
+ option1 = true
+ option2 = "abc.foo"
+ """,
+ )
+ .. ]]]
+
+ .. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [something.plugin]
+ option1 = True
+ option2 = abc.foo
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.something.plugin]
+ option1 = true
+ option2 = "abc.foo"
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:something.plugin]
+ option1 = True
+ option2 = abc.foo
+
+ .. [[[end]]] (checksum: 71aa2ad856e03d228758fd5026fd3a52)
Check the documentation for the plug-in for details on the options it takes.
diff --git a/doc/source.rst b/doc/source.rst
index 41f6fc937..32843a4ff 100644
--- a/doc/source.rst
+++ b/doc/source.rst
@@ -1,6 +1,16 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. This file is processed with cog to create the tabbed multi-syntax
+ configuration examples. If those are wrong, the quality checks will fail.
+ Running "make prebuild" checks them and produces the output.
+
+.. [[[cog
+ from cog_helpers import show_configs
+.. ]]]
+.. [[[end]]] (checksum: d41d8cd98f00b204e9800998ecf8427e)
+
+
.. _source:
=======================
@@ -62,16 +72,74 @@ removed from the set.
The ``include`` and ``omit`` file name patterns follow common shell syntax,
described below in :ref:`source_glob`. Patterns that start with a wildcard
character are used as-is, other patterns are interpreted relative to the
-current directory::
-
- [run]
- omit =
- # omit anything in a .local directory anywhere
- */.local/*
- # omit everything in /usr
- /usr/*
- # omit this single file
- utils/tirefire.py
+current directory:
+
+.. [[[cog
+ show_configs(
+ rc=r"""
+ [run]
+ omit =
+ # omit anything in a .local directory anywhere
+ */.local/*
+ # omit everything in /usr
+ /usr/*
+ # omit this single file
+ utils/tirefire.py
+ """,
+ toml=r"""
+ [tool.coverage.run]
+ omit = [
+ # omit anything in a .local directory anywhere
+ "*/.local/*",
+ # omit everything in /usr
+ "/usr/*",
+ # omit this single file
+ "utils/tirefire.py",
+ ]
+ """,
+ )
+.. ]]]
+
+.. tabs::
+
+ .. code-tab:: ini
+ :caption: .coveragerc
+
+ [run]
+ omit =
+ # omit anything in a .local directory anywhere
+ */.local/*
+ # omit everything in /usr
+ /usr/*
+ # omit this single file
+ utils/tirefire.py
+
+ .. code-tab:: toml
+ :caption: pyproject.toml
+
+ [tool.coverage.run]
+ omit = [
+ # omit anything in a .local directory anywhere
+ "*/.local/*",
+ # omit everything in /usr
+ "/usr/*",
+ # omit this single file
+ "utils/tirefire.py",
+ ]
+
+ .. code-tab:: ini
+ :caption: setup.cfg, tox.ini
+
+ [coverage:run]
+ omit =
+ # omit anything in a .local directory anywhere
+ */.local/*
+ # omit everything in /usr
+ /usr/*
+ # omit this single file
+ utils/tirefire.py
+
+.. [[[end]]] (checksum: 9fa764509b4c484ea613298a20d4b577)
The ``source``, ``include``, and ``omit`` values all work together to determine
the source that will be measured.
From e12a99fd888f16a541dc0e2e5467e4862c18079b Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 4 Jun 2023 15:28:47 -0400
Subject: [PATCH 22/83] docs: clarify the different syntaxes
---
doc/config.rst | 40 +++++++++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/doc/config.rst b/doc/config.rst
index 78fc58a05..061aa5a95 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -27,7 +27,7 @@ specification of options that are otherwise only available in the
Configuration files also make it easier to get coverage testing of spawned
sub-processes. See :ref:`subprocess` for more details.
-The default name for configuration files is ``.coveragerc``, in the same
+The default name for the configuration file is ``.coveragerc``, in the same
directory coverage.py is being run in. Most of the settings in the
configuration file are tied to your source code and how it should be measured,
so it should be stored with your source, and checked into source control,
@@ -46,14 +46,18 @@ prefixed, so the ``[run]`` options described below will be found in the
Coverage.py will read from "pyproject.toml" if TOML support is available,
either because you are running on Python 3.11 or later, or because you
installed with the ``toml`` extra (``pip install coverage[toml]``).
-Configuration must be within the ``[tool.coverage]`` section, for example,
-``[tool.coverage.run]``. Environment variable expansion in values is
-available, but only within quoted strings, even for non-string values.
Syntax
------
+The specific syntax of a configuration file depends on what type it is.
+All configuration files are assumed to be in INI format, unless their file
+extension is .toml, which are TOML.
+
+INI Syntax
+..........
+
A coverage.py configuration file is in classic .ini file format: sections are
introduced by a ``[section]`` header, and contain ``name = value`` entries.
Lines beginning with ``#`` or ``;`` are ignored as comments.
@@ -64,6 +68,22 @@ values on multiple lines.
Boolean values can be specified as ``on``, ``off``, ``true``, ``false``, ``1``,
or ``0`` and are case-insensitive.
+TOML Syntax
+...........
+
+`TOML syntax`_ uses explicit lists with brackets, and strings with quotes.
+Booleans are in ``true`` or ``false``.
+
+Configuration must be within the ``[tool.coverage]`` section, for example,
+``[tool.coverage.run]``. Environment variable expansion in values is
+available, but only within quoted strings, even for non-string values.
+
+.. _TOML syntax: https://toml.io
+
+
+Environment variables
+.....................
+
Environment variables can be substituted in by using dollar signs: ``$WORD``
or ``${WORD}`` will be replaced with the value of ``WORD`` in the environment.
A dollar sign can be inserted with ``$$``. Special forms can be used to
@@ -78,10 +98,11 @@ control what happens if the variable isn't defined in the environment:
- Otherwise, missing environment variables will result in empty strings with no
error.
-Many sections and settings correspond roughly to commands and options in
-the :ref:`command-line interface `.
-Here's a sample configuration file:
+Sample file
+...........
+
+Here's a sample configuration file, in each syntax:
.. [[[cog
show_configs(
@@ -236,6 +257,11 @@ Here's a sample configuration file:
.. [[[end]]] (checksum: 75c6c0c2ee170424cc1c18710e2b4919)
+The specific configuration settings are described below. Many sections and
+settings correspond roughly to commands and options in the :ref:`command-line
+interface `.
+
+
.. _config_run:
[run]
From 452474413843140723d54ab1f29ecb93767d3d9a Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 5 Jun 2023 06:19:37 -0400
Subject: [PATCH 23/83] refactor: ini= is better than rc=
---
doc/cmd.rst | 2 +-
doc/cog_helpers.py | 14 +++++++-------
doc/config.rst | 4 ++--
doc/contexts.rst | 2 +-
doc/excluding.rst | 4 ++--
doc/plugins.rst | 4 ++--
doc/source.rst | 2 +-
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/doc/cmd.rst b/doc/cmd.rst
index 366614734..dda6660c2 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -275,7 +275,7 @@ collected," add this to your configuration file:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[run]
disable_warnings = no-data-collected
""",
diff --git a/doc/cog_helpers.py b/doc/cog_helpers.py
index 94c914f54..56e4630a9 100644
--- a/doc/cog_helpers.py
+++ b/doc/cog_helpers.py
@@ -67,29 +67,29 @@ def _read_config(text, fname):
return text, values
-def show_configs(rc, toml):
+def show_configs(ini, toml):
"""
Show configuration text in a tabbed box.
- `rc` is the ini-file syntax, `toml` is the equivalent TOML syntax.
+ `ini` is the ini-file syntax, `toml` is the equivalent TOML syntax.
The equivalence is checked for accuracy, and the process fails if there's
a mismtach.
A three-tabbed box will be produced.
"""
- rc, rc_vals = _read_config(rc, "covrc")
+ ini, ini_vals = _read_config(ini, "covrc")
toml, toml_vals = _read_config(toml, "covrc.toml")
- for key, val in rc_vals.items():
+ for key, val in ini_vals.items():
if val != toml_vals[key]:
cog.error(f"Mismatch! {key}: {val!r} vs {toml_vals[key]!r}")
- ini = re.sub(r"(?m)^\[", "[coverage:", rc)
+ ini2 = re.sub(r"(?m)^\[", "[coverage:", ini)
print()
print(".. tabs::\n")
for name, syntax, text in [
- (".coveragerc", "ini", rc),
+ (".coveragerc", "ini", ini),
("pyproject.toml", "toml", toml),
- ("setup.cfg, tox.ini", "ini", ini),
+ ("setup.cfg, tox.ini", "ini", ini2),
]:
print(f" .. code-tab:: {syntax}")
print(f" :caption: {name}")
diff --git a/doc/config.rst b/doc/config.rst
index 061aa5a95..d9e690032 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -106,7 +106,7 @@ Here's a sample configuration file, in each syntax:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[run]
branch = True
@@ -492,7 +492,7 @@ equivalent when combining data from different machines:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[paths]
source =
src/
diff --git a/doc/contexts.rst b/doc/contexts.rst
index 686b762be..a277dd8e8 100644
--- a/doc/contexts.rst
+++ b/doc/contexts.rst
@@ -77,7 +77,7 @@ The ``[run] dynamic_context`` setting has only one option now. Set it to
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[run]
dynamic_context = test_function
""",
diff --git a/doc/excluding.rst b/doc/excluding.rst
index a45e57f2a..b4e22b7b2 100644
--- a/doc/excluding.rst
+++ b/doc/excluding.rst
@@ -91,7 +91,7 @@ all of them by adding a regex to the exclusion list:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[report]
exclude_also =
def __repr__
@@ -135,7 +135,7 @@ For example, here's a list of exclusions I've used:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[report]
exclude_also =
def __repr__
diff --git a/doc/plugins.rst b/doc/plugins.rst
index 23034d0db..0bf3af935 100644
--- a/doc/plugins.rst
+++ b/doc/plugins.rst
@@ -48,7 +48,7 @@ a coverage.py plug-in called ``something.plugin``.
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[run]
plugins =
something.plugin
@@ -89,7 +89,7 @@ a coverage.py plug-in called ``something.plugin``.
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[something.plugin]
option1 = True
option2 = abc.foo
diff --git a/doc/source.rst b/doc/source.rst
index 32843a4ff..44b84f001 100644
--- a/doc/source.rst
+++ b/doc/source.rst
@@ -76,7 +76,7 @@ current directory:
.. [[[cog
show_configs(
- rc=r"""
+ ini=r"""
[run]
omit =
# omit anything in a .local directory anywhere
From 49d1bb8d88a9744ab83a34fb44c1c297ec8a4a9e Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 5 Jun 2023 10:20:10 -0400
Subject: [PATCH 24/83] build(docs): doc8 and sphinx-rtd-theme don't agree on a
docutils version
Right now, sphinx-rtd-theme has:
```
install_requires =
sphinx >=1.6,<7
docutils <0.19
sphinxcontrib-jquery >=4,<5
```
and doc8 has:
```
dependencies = [
# Ceiled due to DeprecationWarning: The frontend.OptionParser class will be
# replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
"docutils>=0.19,<0.21",
"restructuredtext-lint>=0.7",
"stevedore",
"tomli; python_version < '3.11'",
"Pygments",
]
```
---
doc/requirements.in | 2 +-
tox.ini | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/requirements.in b/doc/requirements.in
index a6510c6ec..6d1bd330f 100644
--- a/doc/requirements.in
+++ b/doc/requirements.in
@@ -7,7 +7,6 @@
-c ../requirements/pins.pip
cogapp
-doc8
scriv # for writing GitHub releases
sphinx
sphinx-autobuild
@@ -16,5 +15,6 @@ sphinx-code-tabs
sphinxcontrib-restbuilder
# These aren't compatible atm with other library versions:
+#doc8
#pyenchant
#sphinxcontrib-spelling
diff --git a/tox.ini b/tox.ini
index 533dc275f..cf6235335 100644
--- a/tox.ini
+++ b/tox.ini
@@ -70,7 +70,7 @@ allowlist_externals =
commands =
# If this command fails, see the comment at the top of doc/cmd.rst
python -m cogapp -cP --check --verbosity=1 doc/*.rst
- doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
+ ;doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst
sphinx-build -b html -aEnqW doc doc/_build/html
rst2html.py --strict README.rst doc/_build/trash
- sphinx-build -b html -b linkcheck -aEnq doc doc/_build/html
From 137c120e584ded7ab74afd37d65ab54fd308cc69 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 5 Jun 2023 10:21:56 -0400
Subject: [PATCH 25/83] chore: make doc_upgrade
---
doc/requirements.pip | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/doc/requirements.pip b/doc/requirements.pip
index 09eccca44..ff6278bfb 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -24,12 +24,8 @@ cogapp==3.3.0
# via -r doc/requirements.in
colorama==0.4.6
# via sphinx-autobuild
-doc8==0.11.2
- # via -r doc/requirements.in
docutils==0.18.1
# via
- # doc8
- # restructuredtext-lint
# sphinx
# sphinx-rtd-theme
idna==3.4
@@ -42,22 +38,16 @@ jinja2==3.1.2
# sphinx
livereload==2.6.3
# via sphinx-autobuild
-markupsafe==2.1.2
+markupsafe==2.1.3
# via jinja2
packaging==23.1
# via sphinx
-pbr==5.11.1
- # via stevedore
pygments==2.15.1
- # via
- # doc8
- # sphinx
+ # via sphinx
requests==2.31.0
# via
# scriv
# sphinx
-restructuredtext-lint==1.4.0
- # via doc8
scriv==1.3.1
# via -r doc/requirements.in
six==1.16.0
@@ -94,8 +84,6 @@ sphinxcontrib-restbuilder==0.3
# via -r doc/requirements.in
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
-stevedore==5.1.0
- # via doc8
tornado==6.3.2
# via livereload
urllib3==2.0.2
From dd304b477e6c07656aa6a60abdeefcfa470e8273 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 5 Jun 2023 16:37:40 -0400
Subject: [PATCH 26/83] build(docs): rtfd says to use .yaml
---
.readthedocs.yml => .readthedocs.yaml | 0
MANIFEST.in | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename .readthedocs.yml => .readthedocs.yaml (100%)
diff --git a/.readthedocs.yml b/.readthedocs.yaml
similarity index 100%
rename from .readthedocs.yml
rename to .readthedocs.yaml
diff --git a/MANIFEST.in b/MANIFEST.in
index 743ff0ee7..38b0da7ce 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -24,7 +24,7 @@ include setup.py
include tox.ini
include .editorconfig
include .git-blame-ignore-revs
-include .readthedocs.yml
+include .readthedocs.yaml
recursive-include ci *
recursive-include lab *
From e46f2c8af70a6ff2f437022b9ecfe8441f1f5749 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 5 Jun 2023 15:53:15 -0700
Subject: [PATCH 27/83] build(deps): bump deadsnakes/action from 3.0.0 to 3.0.1
(#1636)
Bumps [deadsnakes/action](https://github.com/deadsnakes/action) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/deadsnakes/action/releases)
- [Commits](https://github.com/deadsnakes/action/compare/e3117c2981fd8afe4af79f3e1be80066c82b70f5...22cf137f64f4a2f53399fd7c1880a641bc473ca0)
---
updated-dependencies:
- dependency-name: deadsnakes/action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/python-nightly.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index 431c37143..97a93e6d0 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -61,7 +61,7 @@ jobs:
uses: "actions/checkout@v3"
- name: "Install ${{ matrix.python-version }} with deadsnakes"
- uses: deadsnakes/action@e3117c2981fd8afe4af79f3e1be80066c82b70f5
+ uses: deadsnakes/action@22cf137f64f4a2f53399fd7c1880a641bc473ca0
if: "!startsWith(matrix.python-version, 'pypy-')"
with:
python-version: "${{ matrix.python-version }}"
From 2e09055737aaa7a4c3d61bd1cb700ef528827036 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 7 Jun 2023 06:28:18 -0400
Subject: [PATCH 28/83] docs: correct the capitalization of GitHub
---
README.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.rst b/README.rst
index 5e4024d87..7b88cd194 100644
--- a/README.rst
+++ b/README.rst
@@ -160,10 +160,10 @@ Licensed under the `Apache 2.0 License`_. For details, see `NOTICE.txt`_.
:alt: Tidelift
.. |stars| image:: https://img.shields.io/github/stars/nedbat/coveragepy.svg?logo=github
:target: https://github.com/nedbat/coveragepy/stargazers
- :alt: Github stars
+ :alt: GitHub stars
.. |forks| image:: https://img.shields.io/github/forks/nedbat/coveragepy.svg?logo=github
:target: https://github.com/nedbat/coveragepy/network/members
- :alt: Github forks
+ :alt: GitHub forks
.. |contributors| image:: https://img.shields.io/github/contributors/nedbat/coveragepy.svg?logo=github
:target: https://github.com/nedbat/coveragepy/graphs/contributors
:alt: Contributors
From 1062c56fafb9ccd79412c45cdec822a23dd05d90 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 9 Jun 2023 12:15:27 -0700
Subject: [PATCH 29/83] build(deps): bump docker/setup-qemu-action from 2.1.0
to 2.2.0 (#1637)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/e81a89b1732b9c48d79cd809d8d81d79c4647a18...2b82ce82d56a2a04d2637cd93a637ae1b359c0a7)
---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/kit.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index 53e081455..bb0a66bcc 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -144,7 +144,7 @@ jobs:
steps:
- name: "Setup QEMU"
if: matrix.os == 'ubuntu'
- uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
+ uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7
with:
platforms: arm64
From 5826562074b7a752116374d587940eb0c1aaf955 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 12 Jun 2023 09:24:48 -0400
Subject: [PATCH 30/83] test(docs): make a comment more correct
---
tests/conftest.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 51bab8d2b..98ff5d4d3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -23,7 +23,7 @@
from coverage.files import set_relative_directory
# Pytest will rewrite assertions in test modules, but not elsewhere.
-# This tells pytest to also rewrite assertions in coveragetest.py.
+# This tells pytest to also rewrite assertions in these files:
pytest.register_assert_rewrite("tests.coveragetest")
pytest.register_assert_rewrite("tests.helpers")
From 1283c8dd92f5dc68571db719fceeab7a5dea5a79 Mon Sep 17 00:00:00 2001
From: Kenneth Schackart
Date: Tue, 13 Jun 2023 02:56:02 -0700
Subject: [PATCH 31/83] docs: add CITATION.cff (#1641)
* Add CITATION.cff
* Update manifest with CITATION.cff
* Update authors field
---
CITATION.cff | 19 +++++++++++++++++++
MANIFEST.in | 1 +
2 files changed, 20 insertions(+)
create mode 100644 CITATION.cff
diff --git a/CITATION.cff b/CITATION.cff
new file mode 100644
index 000000000..99d4ab40e
--- /dev/null
+++ b/CITATION.cff
@@ -0,0 +1,19 @@
+cff-version: 1.2.0
+title: "Coverage.py: The code coverage tool for Python"
+message: >-
+ If you use this software, please cite it using the metadata from this file.
+type: software
+authors:
+ - family-names: Batchelder
+ given-names: Ned
+ orcid: https://orcid.org/0009-0006-2659-884X
+ - name: "Contributors to Coverage.py"
+repository-code: "https://github.com/nedbat/coveragepy"
+url: "https://coverage.readthedocs.io/"
+abstract: >-
+ Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program,
+ noting which parts of the code have been executed, then analyzes the source to identify code
+ that could have been executed but was not.
+ Coverage measurement is typically used to gauge the effectiveness of tests. It can show which
+ parts of your code are being exercised by tests, and which are not.
+license: Apache-2.0
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
index 38b0da7ce..f61de19cf 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -8,6 +8,7 @@
# .tar.gz source distribution would give you everything needed to continue
# developing the project. "pip install" will not install many of these files.
+include CITATION.cff
include CONTRIBUTORS.txt
include CHANGES.rst
include LICENSE.txt
From 4305d5290a0496bce21c4c0bfccf92b329a487b2 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Tue, 13 Jun 2023 06:04:30 -0400
Subject: [PATCH 32/83] docs: changes and contributor for CITATION.cff
---
CHANGES.rst | 10 +++++++---
CITATION.cff | 5 ++++-
CONTRIBUTORS.txt | 1 +
MANIFEST.in | 8 ++++----
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index bd83dce25..0d68acf03 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,9 +20,13 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
-- Fix: add ``nosemgrep`` comments to our JavaScript code so that semgrep-based
- SAST security checks won't raise false alarms about security problems that
- aren't problems.
+- Fix: added ``nosemgrep`` comments to our JavaScript code so that
+ semgrep-based SAST security checks won't raise false alarms about security
+ problems that aren't problems.
+
+- Added a CITATION.cff file, thanks to `Ken Schackart `_.
+
+.. _pull 1641: https://github.com/nedbat/coveragepy/pull/1641
.. scriv-start-here
diff --git a/CITATION.cff b/CITATION.cff
index 99d4ab40e..30e1e884c 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -1,3 +1,6 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+
cff-version: 1.2.0
title: "Coverage.py: The code coverage tool for Python"
message: >-
@@ -16,4 +19,4 @@ abstract: >-
that could have been executed but was not.
Coverage measurement is typically used to gauge the effectiveness of tests. It can show which
parts of your code are being exercised by tests, and which are not.
-license: Apache-2.0
\ No newline at end of file
+license: Apache-2.0
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index c3dfef428..dcf651ae8 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -114,6 +114,7 @@ Julien Voisin
Justas Sadzevičius
Karthikeyan Singaravelan
Kassandra Keeton
+Ken Schackart
Kevin Brown-Silva
Kjell Braden
Krystian Kichewko
diff --git a/MANIFEST.in b/MANIFEST.in
index f61de19cf..2a3ed4408 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -8,9 +8,12 @@
# .tar.gz source distribution would give you everything needed to continue
# developing the project. "pip install" will not install many of these files.
+include .editorconfig
+include .git-blame-ignore-revs
+include .readthedocs.yaml
+include CHANGES.rst
include CITATION.cff
include CONTRIBUTORS.txt
-include CHANGES.rst
include LICENSE.txt
include MANIFEST.in
include Makefile
@@ -23,9 +26,6 @@ include metacov.ini
include pylintrc
include setup.py
include tox.ini
-include .editorconfig
-include .git-blame-ignore-revs
-include .readthedocs.yaml
recursive-include ci *
recursive-include lab *
From 5248314f69a3ead6497b2d07c866de9da82d69f1 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 14 Jun 2023 06:37:09 -0400
Subject: [PATCH 33/83] docs: oops, multi-config docs were credited to the
wrong release
---
CHANGES.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 0d68acf03..9b2efc9e0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,6 +20,9 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Docs: examples of configuration files now include separate examples for the
+ different syntaxes: .coveragerc, pyproject.toml, setup.cfg, and tox.ini.
+
- Fix: added ``nosemgrep`` comments to our JavaScript code so that
semgrep-based SAST security checks won't raise false alarms about security
problems that aren't problems.
@@ -42,9 +45,6 @@ Version 7.2.7 — 2023-05-29
recent change (`issue 1538`_). Thanks to `Anders Kaseorg `_
and David Szotten for persisting with problem reports and detailed diagnoses.
-- Docs: examples of configuration files now include separate examples for the
- different syntaxes: .coveragerc, pyproject.toml, setup.cfg, and tox.ini.
-
- Wheels are now provided for CPython 3.12.
.. _issue 1586: https://github.com/nedbat/coveragepy/issues/1586
From 50ca55869ce2c5c325f896e6ff83e24ce583f2a7 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 07:59:12 -0400
Subject: [PATCH 34/83] build: drop support for Python 3.7
---
.github/workflows/coverage.yml | 8 +-------
.github/workflows/kit.yml | 6 +++---
.github/workflows/python-nightly.yml | 1 -
.github/workflows/quality.yml | 2 +-
.github/workflows/testsuite.yml | 3 +--
CHANGES.rst | 2 ++
README.rst | 2 +-
doc/cmd.rst | 4 ++--
doc/contributing.rst | 2 +-
doc/index.rst | 2 +-
setup.py | 3 +--
tox.ini | 7 +++----
12 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index ab94a83e3..4e2e5fa31 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -43,26 +43,20 @@ jobs:
# tox.ini so that tox will run properly. PYVERSIONS
# Available versions:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
- - "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- - "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
exclude:
# Windows PyPy doesn't seem to work?
- - os: windows-latest
- python-version: "pypy-3.7"
- os: windows-latest
python-version: "pypy-3.8"
- os: windows-latest
python-version: "pypy-3.9"
# Mac PyPy always takes the longest, and doesn't add anything.
- - os: macos-latest
- python-version: "pypy-3.7"
- os: macos-latest
python-version: "pypy-3.8"
- os: macos-latest
@@ -126,7 +120,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
- python-version: "3.7" # Minimum of PYVERSIONS
+ python-version: "3.8" # Minimum of PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index bb0a66bcc..bc9ec6322 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -78,7 +78,7 @@ jobs:
# # PYVERSIONS. Available versions:
# # https://github.com/actions/python-versions/blob/main/versions-manifest.json
# # PyPy versions are handled further below in the "pypy" step.
- # pys = ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
+ # pys = ["cp38", "cp39", "cp310", "cp311", "cp312"]
#
# # Some OS/arch combinations need overrides for the Python versions:
# os_arch_pys = {
@@ -228,7 +228,7 @@ jobs:
- name: "Install PyPy"
uses: actions/setup-python@v4
with:
- python-version: "pypy-3.7" # Minimum of PyPy PYVERSIONS
+ python-version: "pypy-3.8" # Minimum of PyPy PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'
@@ -240,7 +240,7 @@ jobs:
run: |
# One wheel works for all PyPy versions. PYVERSIONS
# yes, this is weird syntax: https://github.com/pypa/build/issues/202
- pypy3 -m build -w -C="--global-option=--python-tag" -C="--global-option=pp37.pp38.pp39"
+ pypy3 -m build -w -C="--global-option=--python-tag" -C="--global-option=pp38.pp39"
- name: "List wheels"
run: |
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index 97a93e6d0..8e5ade8ae 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -50,7 +50,6 @@ jobs:
- "3.11-dev"
- "3.12-dev"
# https://github.com/actions/setup-python#available-versions-of-pypy
- - "pypy-3.7-nightly"
- "pypy-3.8-nightly"
- "pypy-3.9-nightly"
- "pypy-3.10-nightly"
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
index 11d2e3fc0..847bfd7cc 100644
--- a/.github/workflows/quality.yml
+++ b/.github/workflows/quality.yml
@@ -40,7 +40,7 @@ jobs:
- name: "Install Python"
uses: "actions/setup-python@v4"
with:
- python-version: "3.7" # Minimum of PYVERSIONS
+ python-version: "3.8" # Minimum of PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index d87a5c725..8d21c4131 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -45,13 +45,12 @@ jobs:
# Available versions:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#available-versions-of-python-and-pypy
- - "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- - "pypy-3.7"
+ - "pypy-3.8"
- "pypy-3.9"
exclude:
# Windows PyPy-3.9 always gets killed.
diff --git a/CHANGES.rst b/CHANGES.rst
index 9b2efc9e0..ad8d7ac5a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,6 +20,8 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Dropped support for Python 3.7.
+
- Docs: examples of configuration files now include separate examples for the
different syntaxes: .coveragerc, pyproject.toml, setup.cfg, and tox.ini.
diff --git a/README.rst b/README.rst
index 7b88cd194..87bbead7b 100644
--- a/README.rst
+++ b/README.rst
@@ -28,7 +28,7 @@ Coverage.py runs on these versions of Python:
.. PYVERSIONS
-* CPython 3.7 through 3.12.0b1
+* CPython 3.8 through 3.12.0b2
* PyPy3 7.3.11.
Documentation is on `Read the Docs`_. Code repository and issue tracker are on
diff --git a/doc/cmd.rst b/doc/cmd.rst
index dda6660c2..90667cabd 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -21,8 +21,8 @@ Command line usage
When you install coverage.py, a command-line script called ``coverage`` is
placed on your path. To help with multi-version installs, it will also create
a ``coverage3`` alias, and a ``coverage-X.Y`` alias, depending on the version
-of Python you're using. For example, when installing on Python 3.7, you will
-be able to use ``coverage``, ``coverage3``, or ``coverage-3.7`` on the command
+of Python you're using. For example, when installing on Python 3.10, you will
+be able to use ``coverage``, ``coverage3``, or ``coverage-3.10`` on the command
line.
Coverage.py has a number of commands:
diff --git a/doc/contributing.rst b/doc/contributing.rst
index fa7bb9f0c..82e6d069b 100644
--- a/doc/contributing.rst
+++ b/doc/contributing.rst
@@ -218,7 +218,7 @@ files. These are created by running ``make upgrade``.
.. minimum of PYVERSIONS:
-It's important to use Python 3.7 to run ``make upgrade`` so that the pinned
+It's important to use Python 3.8 to run ``make upgrade`` so that the pinned
versions will work on all of the Python versions currently supported by
coverage.py.
diff --git a/doc/index.rst b/doc/index.rst
index e70ec7699..24ebb6d32 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.7 through 3.12.0b1.
+* Python versions 3.8 through 3.12.0b2.
* PyPy3 7.3.11.
.. PYVERSIONS
diff --git a/setup.py b/setup.py
index 90763f94c..5222adea0 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,6 @@
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
-Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
@@ -131,7 +130,7 @@
'Mastodon': 'https://hachyderm.io/@coveragepy',
'Mastodon (nedbat)': 'https://hachyderm.io/@nedbat',
},
- python_requires=">=3.7", # minimum of PYVERSIONS
+ python_requires=">=3.8", # minimum of PYVERSIONS
)
# A replacement for the build_ext command which raises a single exception
diff --git a/tox.ini b/tox.ini
index cf6235335..aacc2fbeb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
[tox]
# When changing this list, be sure to check the [gh] list below.
# PYVERSIONS
-envlist = py{37,38,39,310,311,312}, pypy3, doc, lint, mypy
+envlist = py{38,39,310,311,312}, pypy3, doc, lint, mypy
skip_missing_interpreters = {env:COVERAGE_SKIP_MISSING_INTERPRETERS:True}
toxworkdir = {env:TOXWORKDIR:.tox}
@@ -18,7 +18,7 @@ extras =
deps =
-r requirements/pip.pip
-r requirements/pytest.pip
- py{37,38,39,310,311}: -r requirements/light-threads.pip
+ py{38,39,310,311}: -r requirements/light-threads.pip
# Windows can't update the pip version with pip running, so use Python
# to install things.
@@ -78,7 +78,7 @@ commands =
[testenv:lint]
# Minimum of PYVERSIONS
-basepython = python3.7
+basepython = python3.8
deps =
-r requirements/dev.pip
@@ -117,7 +117,6 @@ commands =
# https://pypi.org/project/tox-gh/
# PYVERSIONS
python =
- 3.7 = py37
3.8 = py38
3.9 = py39
3.10 = py310
From b365346dd573a14709e74db2119709f45cac1e14 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 08:09:15 -0400
Subject: [PATCH 35/83] chore: make upgrade (first on 3.8)
---
requirements/dev.pip | 38 ++++++++++++----------------------
requirements/kit.pip | 21 ++++++-------------
requirements/light-threads.pip | 2 +-
requirements/mypy.pip | 19 ++++-------------
requirements/pip-tools.pip | 10 +--------
requirements/pip.pip | 14 +++----------
requirements/pytest.pip | 15 +++-----------
requirements/tox.pip | 24 ++++++---------------
8 files changed, 37 insertions(+), 106 deletions(-)
diff --git a/requirements/dev.pip b/requirements/dev.pip
index fc49f5ebc..5be9b8e41 100644
--- a/requirements/dev.pip
+++ b/requirements/dev.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -41,7 +41,7 @@ exceptiongroup==1.1.1
# pytest
execnet==1.9.0
# via pytest-xdist
-filelock==3.12.0
+filelock==3.12.2
# via
# tox
# virtualenv
@@ -49,25 +49,19 @@ flaky==3.7.0
# via -r requirements/pytest.in
greenlet==2.0.2
# via -r requirements/dev.in
-hypothesis==6.75.9
+hypothesis==6.78.3
# via -r requirements/pytest.in
idna==3.4
# via requests
importlib-metadata==6.6.0
# via
- # attrs
- # build
# keyring
- # pluggy
- # pytest
- # tox
# twine
- # virtualenv
importlib-resources==5.12.0
# via keyring
iniconfig==2.0.0
# via pytest
-isort==5.11.5
+isort==5.12.0
# via pylint
jaraco-classes==3.2.3
# via keyring
@@ -79,7 +73,7 @@ lazy-object-proxy==1.9.0
# via astroid
libsass==0.22.0
# via -r requirements/dev.in
-markdown-it-py==2.2.0
+markdown-it-py==3.0.0
# via rich
mccabe==0.7.0
# via pylint
@@ -98,7 +92,7 @@ parso==0.8.3
# via jedi
pkginfo==1.9.6
# via twine
-platformdirs==3.5.1
+platformdirs==3.5.3
# via
# pylint
# tox
@@ -116,11 +110,11 @@ pygments==2.15.1
# rich
pylint==2.17.4
# via -r requirements/dev.in
-pyproject-api==1.5.1
+pyproject-api==1.5.2
# via tox
pyproject-hooks==1.0.0
# via build
-pytest==7.3.1
+pytest==7.3.2
# via
# -r requirements/pytest.in
# pytest-xdist
@@ -139,7 +133,7 @@ requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
-rich==13.4.1
+rich==13.4.2
# via twine
six==1.16.0
# via bleach
@@ -156,26 +150,20 @@ tomli==2.0.1
# tox
tomlkit==0.11.8
# via pylint
-tox==4.5.2
+tox==4.6.1
# via
# -r requirements/tox.in
# tox-gh
-tox-gh==1.0.0
+tox-gh==1.2.0
# via -r requirements/tox.in
twine==4.0.2
# via -r requirements/dev.in
-typed-ast==1.5.4
- # via astroid
-typing-extensions==4.6.2
+typing-extensions==4.6.3
# via
# astroid
- # importlib-metadata
- # markdown-it-py
- # platformdirs
# pylint
# rich
- # tox
-urllib3==2.0.2
+urllib3==2.0.3
# via
# requests
# twine
diff --git a/requirements/kit.pip b/requirements/kit.pip
index 608c3f79b..39b53bee6 100644
--- a/requirements/kit.pip
+++ b/requirements/kit.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -14,21 +14,17 @@ build==0.10.0
# via -r requirements/kit.in
certifi==2023.5.7
# via cibuildwheel
-cibuildwheel==2.13.0
+cibuildwheel==2.13.1
# via -r requirements/kit.in
colorama==0.4.6
# via -r requirements/kit.in
-filelock==3.12.0
+filelock==3.12.2
# via cibuildwheel
-importlib-metadata==6.6.0
- # via
- # auditwheel
- # build
packaging==23.1
# via
# build
# cibuildwheel
-platformdirs==3.5.1
+platformdirs==3.5.3
# via cibuildwheel
pyelftools==0.29
# via auditwheel
@@ -39,15 +35,10 @@ tomli==2.0.1
# build
# cibuildwheel
# pyproject-hooks
-typing-extensions==4.6.2
- # via
- # cibuildwheel
- # importlib-metadata
- # platformdirs
+typing-extensions==4.6.3
+ # via cibuildwheel
wheel==0.40.0
# via -r requirements/kit.in
-zipp==3.15.0
- # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
setuptools==67.8.0
diff --git a/requirements/light-threads.pip b/requirements/light-threads.pip
index a633004df..6a61df24a 100644
--- a/requirements/light-threads.pip
+++ b/requirements/light-threads.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
diff --git a/requirements/mypy.pip b/requirements/mypy.pip
index fc34dc2c7..f19142bb2 100644
--- a/requirements/mypy.pip
+++ b/requirements/mypy.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -16,13 +16,8 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.9
+hypothesis==6.78.3
# via -r requirements/pytest.in
-importlib-metadata==6.6.0
- # via
- # attrs
- # pluggy
- # pytest
iniconfig==2.0.0
# via pytest
mypy==1.3.0
@@ -33,7 +28,7 @@ packaging==23.1
# via pytest
pluggy==1.0.0
# via pytest
-pytest==7.3.1
+pytest==7.3.2
# via
# -r requirements/pytest.in
# pytest-xdist
@@ -45,11 +40,5 @@ tomli==2.0.1
# via
# mypy
# pytest
-typed-ast==1.5.4
+typing-extensions==4.6.3
# via mypy
-typing-extensions==4.6.2
- # via
- # importlib-metadata
- # mypy
-zipp==3.15.0
- # via importlib-metadata
diff --git a/requirements/pip-tools.pip b/requirements/pip-tools.pip
index b720cb51f..514a7352e 100644
--- a/requirements/pip-tools.pip
+++ b/requirements/pip-tools.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -8,10 +8,6 @@ build==0.10.0
# via pip-tools
click==8.1.3
# via pip-tools
-importlib-metadata==6.6.0
- # via
- # build
- # click
packaging==23.1
# via build
pip-tools==6.13.0
@@ -22,12 +18,8 @@ tomli==2.0.1
# via
# build
# pyproject-hooks
-typing-extensions==4.6.2
- # via importlib-metadata
wheel==0.40.0
# via pip-tools
-zipp==3.15.0
- # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
pip==23.1.2
diff --git a/requirements/pip.pip b/requirements/pip.pip
index 0cc81df43..bfe0993bb 100644
--- a/requirements/pip.pip
+++ b/requirements/pip.pip
@@ -1,25 +1,17 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
distlib==0.3.6
# via virtualenv
-filelock==3.12.0
+filelock==3.12.2
# via virtualenv
-importlib-metadata==6.6.0
+platformdirs==3.5.3
# via virtualenv
-platformdirs==3.5.1
- # via virtualenv
-typing-extensions==4.6.2
- # via
- # importlib-metadata
- # platformdirs
virtualenv==20.23.0
# via -r requirements/pip.in
-zipp==3.15.0
- # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
pip==23.1.2
diff --git a/requirements/pytest.pip b/requirements/pytest.pip
index 7ee500449..dd20bada2 100644
--- a/requirements/pytest.pip
+++ b/requirements/pytest.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -16,20 +16,15 @@ execnet==1.9.0
# via pytest-xdist
flaky==3.7.0
# via -r requirements/pytest.in
-hypothesis==6.75.9
+hypothesis==6.78.3
# via -r requirements/pytest.in
-importlib-metadata==6.6.0
- # via
- # attrs
- # pluggy
- # pytest
iniconfig==2.0.0
# via pytest
packaging==23.1
# via pytest
pluggy==1.0.0
# via pytest
-pytest==7.3.1
+pytest==7.3.2
# via
# -r requirements/pytest.in
# pytest-xdist
@@ -39,7 +34,3 @@ sortedcontainers==2.4.0
# via hypothesis
tomli==2.0.1
# via pytest
-typing-extensions==4.6.2
- # via importlib-metadata
-zipp==3.15.0
- # via importlib-metadata
diff --git a/requirements/tox.pip b/requirements/tox.pip
index 759f13cef..fb0ea18d6 100644
--- a/requirements/tox.pip
+++ b/requirements/tox.pip
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.7
+# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
@@ -14,43 +14,31 @@ colorama==0.4.6
# tox
distlib==0.3.6
# via virtualenv
-filelock==3.12.0
+filelock==3.12.2
# via
# tox
# virtualenv
-importlib-metadata==6.6.0
- # via
- # pluggy
- # tox
- # virtualenv
packaging==23.1
# via
# pyproject-api
# tox
-platformdirs==3.5.1
+platformdirs==3.5.3
# via
# tox
# virtualenv
pluggy==1.0.0
# via tox
-pyproject-api==1.5.1
+pyproject-api==1.5.2
# via tox
tomli==2.0.1
# via
# pyproject-api
# tox
-tox==4.5.2
+tox==4.6.1
# via
# -r requirements/tox.in
# tox-gh
-tox-gh==1.0.0
+tox-gh==1.2.0
# via -r requirements/tox.in
-typing-extensions==4.6.2
- # via
- # importlib-metadata
- # platformdirs
- # tox
virtualenv==20.23.0
# via tox
-zipp==3.15.0
- # via importlib-metadata
From 0e8432794c42834f8b058ebfdc0334e63047c8da Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 08:13:08 -0400
Subject: [PATCH 36/83] chore: make prebuild
---
.github/workflows/kit.yml | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index bc9ec6322..dbc1a4bbb 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -98,19 +98,16 @@ jobs:
# }
# print(f"- {json.dumps(them)}")
# ]]]
- - {"os": "ubuntu", "py": "cp37", "arch": "x86_64"}
- {"os": "ubuntu", "py": "cp38", "arch": "x86_64"}
- {"os": "ubuntu", "py": "cp39", "arch": "x86_64"}
- {"os": "ubuntu", "py": "cp310", "arch": "x86_64"}
- {"os": "ubuntu", "py": "cp311", "arch": "x86_64"}
- {"os": "ubuntu", "py": "cp312", "arch": "x86_64"}
- - {"os": "ubuntu", "py": "cp37", "arch": "i686"}
- {"os": "ubuntu", "py": "cp38", "arch": "i686"}
- {"os": "ubuntu", "py": "cp39", "arch": "i686"}
- {"os": "ubuntu", "py": "cp310", "arch": "i686"}
- {"os": "ubuntu", "py": "cp311", "arch": "i686"}
- {"os": "ubuntu", "py": "cp312", "arch": "i686"}
- - {"os": "ubuntu", "py": "cp37", "arch": "aarch64"}
- {"os": "ubuntu", "py": "cp38", "arch": "aarch64"}
- {"os": "ubuntu", "py": "cp39", "arch": "aarch64"}
- {"os": "ubuntu", "py": "cp310", "arch": "aarch64"}
@@ -120,25 +117,22 @@ jobs:
- {"os": "macos", "py": "cp39", "arch": "arm64"}
- {"os": "macos", "py": "cp310", "arch": "arm64"}
- {"os": "macos", "py": "cp311", "arch": "arm64"}
- - {"os": "macos", "py": "cp37", "arch": "x86_64"}
- {"os": "macos", "py": "cp38", "arch": "x86_64"}
- {"os": "macos", "py": "cp39", "arch": "x86_64"}
- {"os": "macos", "py": "cp310", "arch": "x86_64"}
- {"os": "macos", "py": "cp311", "arch": "x86_64"}
- {"os": "macos", "py": "cp312", "arch": "x86_64"}
- - {"os": "windows", "py": "cp37", "arch": "x86"}
- {"os": "windows", "py": "cp38", "arch": "x86"}
- {"os": "windows", "py": "cp39", "arch": "x86"}
- {"os": "windows", "py": "cp310", "arch": "x86"}
- {"os": "windows", "py": "cp311", "arch": "x86"}
- {"os": "windows", "py": "cp312", "arch": "x86"}
- - {"os": "windows", "py": "cp37", "arch": "AMD64"}
- {"os": "windows", "py": "cp38", "arch": "AMD64"}
- {"os": "windows", "py": "cp39", "arch": "AMD64"}
- {"os": "windows", "py": "cp310", "arch": "AMD64"}
- {"os": "windows", "py": "cp311", "arch": "AMD64"}
- {"os": "windows", "py": "cp312", "arch": "AMD64"}
- # [[[end]]] (checksum: 5e62f362263935c1e3a21299f8a1b649)
+ # [[[end]]] (checksum: 599179a7b8d2f8d1a69f0a7c6e5e57ba)
fail-fast: false
steps:
From 3c5b78a668e8b92bc6d4eaa2cf94a0bf40455c61 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 18:33:53 -0400
Subject: [PATCH 37/83] style: remove now-uneeded pylint pragmas
---
coverage/pytracer.py | 1 -
tests/test_api.py | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/coverage/pytracer.py b/coverage/pytracer.py
index 81832b0fd..e6b02a362 100644
--- a/coverage/pytracer.py
+++ b/coverage/pytracer.py
@@ -52,7 +52,6 @@ class PyTracer(TTracer):
# used to force the use of this tracer.
def __init__(self) -> None:
- # pylint: disable=super-init-not-called
# Attributes set from the collector:
self.data: TTraceData
self.trace_arcs = False
diff --git a/tests/test_api.py b/tests/test_api.py
index 5c903d65f..e7877a999 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -817,7 +817,7 @@ def test_bug_572(self) -> None:
class CoverageUsePkgs(Protocol):
"""A number of test classes have the same helper method."""
def coverage_usepkgs(
- self, # pylint: disable=unused-argument
+ self,
**kwargs: TCovKwargs,
) -> Iterable[str]:
"""Run coverage on usepkgs, return a line summary. kwargs are for Coverage(**kwargs)."""
From 1676dece4d06738ae7b817db39199ed2427a7f0e Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 15:58:04 -0400
Subject: [PATCH 38/83] test: the nice link never worked, take it out
---
.github/workflows/coverage.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 4e2e5fa31..1543d76db 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -213,8 +213,6 @@ jobs:
# Make the commit message.
echo "${{ env.total }}% - $COMMIT_MESSAGE" > commit.txt
echo "" >> commit.txt
- echo "[View the report](${{ env.url }})" >> commit.txt
- echo "" >> commit.txt
echo "${{ env.url }}" >> commit.txt
echo "${{ env.sha10 }}: ${{ env.branch }}" >> commit.txt
# Commit.
From d1f9a6a19ccb9b79ac7521a69ae7a019a559ebfc Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 16 Jun 2023 15:00:45 -0400
Subject: [PATCH 39/83] refactor: remove 3.7-only conditions
---
coverage/env.py | 24 ++----------------------
coverage/parser.py | 28 +++++++++++++---------------
tests/test_arcs.py | 28 +++++++---------------------
tests/test_coverage.py | 12 +++---------
tests/test_parser.py | 19 +++++--------------
tests/test_report_common.py | 15 ++++++---------
6 files changed, 36 insertions(+), 90 deletions(-)
diff --git a/coverage/env.py b/coverage/env.py
index 3370970e3..3683e0001 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -52,15 +52,10 @@ class PYBEHAVIOR:
elif PYPY:
if PYVERSION >= (3, 9):
optimize_if_not_debug = 2
- elif PYVERSION[:2] == (3, 8):
- optimize_if_not_debug = 3
else:
- optimize_if_not_debug = 1
+ optimize_if_not_debug = 3
else:
- if PYVERSION >= (3, 8, 0, "beta", 1):
- optimize_if_not_debug = 2
- else:
- optimize_if_not_debug = 1
+ optimize_if_not_debug = 2
# Can co_lnotab have negative deltas?
negative_lnotab = not (PYPY and PYPYVERSION < (7, 2))
@@ -76,25 +71,10 @@ class PYBEHAVIOR:
if PYPY and PYPYVERSION < (7, 3, 7):
finally_jumps_back = False
- # 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)) and
- (CPYTHON or (PYVERSION > (3, 8)) or (PYPYVERSION > (7, 3, 9)))
- )
-
- # Functions are no longer claimed to start at their earliest decorator even though
- # the decorators are traced?
- def_ast_no_decorator = (PYPY and PYVERSION >= (3, 9))
-
# CPython 3.11 now jumps to the decorator line again while executing
# the decorator.
trace_decorator_line_again = (CPYTHON and PYVERSION > (3, 11, 0, "alpha", 3, 0))
- # Are while-true loops optimized into absolute jumps with no loop setup?
- nix_while_true = (PYVERSION >= (3, 8))
-
# CPython 3.9a1 made sys.argv[0] and other reported files absolute paths.
report_absolute_files = (
(CPYTHON or (PYPY and PYPYVERSION >= (7, 3, 10)))
diff --git a/coverage/parser.py b/coverage/parser.py
index 51a5a52da..00a3b75bb 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -747,10 +747,10 @@ def line_for_node(self, node: ast.AST) -> TLineNo:
def _line_decorated(self, node: ast.FunctionDef) -> TLineNo:
"""Compute first line number for things that can be decorated (classes and functions)."""
- lineno = node.lineno
- if env.PYBEHAVIOR.trace_decorated_def or env.PYBEHAVIOR.def_ast_no_decorator:
- if node.decorator_list:
- lineno = node.decorator_list[0].lineno
+ if node.decorator_list:
+ lineno = node.decorator_list[0].lineno
+ else:
+ lineno = node.lineno
return lineno
def _line__Assign(self, node: ast.Assign) -> TLineNo:
@@ -1007,17 +1007,15 @@ def _handle_decorated(self, node: ast.FunctionDef) -> Set[ArcStart]:
last: Optional[TLineNo] = node.lineno
decs = node.decorator_list
if decs:
- if env.PYBEHAVIOR.trace_decorated_def or env.PYBEHAVIOR.def_ast_no_decorator:
- last = None
+ last = None
for dec_node in decs:
dec_start = self.line_for_node(dec_node)
- if last is not None and dec_start != last:
- self.add_arc(last, dec_start)
+ if last is not None and dec_start != last: # type: ignore[unreachable]
+ self.add_arc(last, dec_start) # type: ignore[unreachable]
last = dec_start
assert last is not None
- if env.PYBEHAVIOR.trace_decorated_def:
- self.add_arc(last, main_line)
- last = main_line
+ self.add_arc(last, main_line)
+ last = main_line
if env.PYBEHAVIOR.trace_decorator_line_again:
for top, bot in zip(decs, decs[1:]):
self.add_arc(self.line_for_node(bot), self.line_for_node(top))
@@ -1030,10 +1028,10 @@ def _handle_decorated(self, node: ast.FunctionDef) -> Set[ArcStart]:
if node.body:
body_start = self.line_for_node(node.body[0])
body_start = self.multiline.get(body_start, body_start)
- for lineno in range(last+1, body_start):
- if lineno in self.statements:
- self.add_arc(last, lineno)
- last = lineno
+ # for lineno in range(last+1, body_start):
+ # if lineno in self.statements:
+ # self.add_arc(last, lineno)
+ # last = lineno
# The body is handled in collect_arcs.
assert last is not None
return {ArcStart(last)}
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 1f46064f6..cb013630b 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -419,10 +419,8 @@ def test_while_1(self) -> None:
# With "while 1", the loop knows it's constant.
if env.PYBEHAVIOR.keep_constant_test:
arcz = ".1 12 23 34 45 36 62 57 7."
- elif env.PYBEHAVIOR.nix_while_true:
- arcz = ".1 13 34 45 36 63 57 7."
else:
- arcz = ".1 12 23 34 45 36 63 57 7."
+ arcz = ".1 13 34 45 36 63 57 7."
self.check_coverage("""\
a, i = 1, 0
while 1:
@@ -440,10 +438,8 @@ def test_while_true(self) -> None:
# 3.x thinks it's constant.
if env.PYBEHAVIOR.keep_constant_test:
arcz = ".1 12 23 34 45 36 62 57 7."
- elif env.PYBEHAVIOR.nix_while_true:
- arcz = ".1 13 34 45 36 63 57 7."
else:
- arcz = ".1 12 23 34 45 36 63 57 7."
+ arcz = ".1 13 34 45 36 63 57 7."
self.check_coverage("""\
a, i = 1, 0
while True:
@@ -469,10 +465,8 @@ def method(self):
assert self.stdout() == 'done\n'
if env.PYBEHAVIOR.keep_constant_test:
num_stmts = 3
- elif env.PYBEHAVIOR.nix_while_true:
- num_stmts = 2
else:
- num_stmts = 3
+ num_stmts = 2
expected = "zero.py {n} {n} 0 0 0% 1-3".format(n=num_stmts)
report = self.get_report(cov, show_missing=True)
squeezed = self.squeezed_lines(report)
@@ -483,10 +477,8 @@ def test_bug_496_continue_in_constant_while(self) -> None:
# A continue in a while-true needs to jump to the right place.
if env.PYBEHAVIOR.keep_constant_test:
arcz = ".1 12 23 34 45 52 46 67 7."
- elif env.PYBEHAVIOR.nix_while_true:
- arcz = ".1 13 34 45 53 46 67 7."
else:
- arcz = ".1 12 23 34 45 53 46 67 7."
+ arcz = ".1 13 34 45 53 46 67 7."
self.check_coverage("""\
up = iter('ta')
while True:
@@ -1730,9 +1722,7 @@ class MyObject(
def test_bug_466a(self) -> None:
# A bad interaction between decorators and multi-line list assignments,
# believe it or not...!
- arcz = ".1 1A A. 13 3. -35 58 8-3 "
- if env.PYBEHAVIOR.trace_decorated_def:
- arcz = arcz.replace("3.", "34 4.")
+ arcz = ".1 1A A. 13 34 4. -35 58 8-3 "
if env.PYBEHAVIOR.trace_decorator_line_again:
arcz += "43 "
# This example makes more sense when considered in tandem with 466b below.
@@ -1754,9 +1744,7 @@ def parse(cls):
def test_bug_466b(self) -> None:
# A bad interaction between decorators and multi-line list assignments,
# believe it or not...!
- arcz = ".1 1A A. 13 3. -35 58 8-3 "
- if env.PYBEHAVIOR.trace_decorated_def:
- arcz = arcz.replace("3.", "34 4.")
+ arcz = ".1 1A A. 13 34 4. -35 58 8-3 "
if env.PYBEHAVIOR.trace_decorator_line_again:
arcz += "43 "
self.check_coverage("""\
@@ -1943,9 +1931,7 @@ async def go():
)
def test_async_decorator(self) -> None:
- arcz = ".1 14 4. .2 2. -46 6-4 "
- if env.PYBEHAVIOR.trace_decorated_def:
- arcz = arcz.replace("4.", "45 5.")
+ arcz = ".1 14 45 5. .2 2. -46 6-4 "
if env.PYBEHAVIOR.trace_decorator_line_again:
arcz += "54 "
self.check_coverage("""\
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 1cade9cbc..84bf2b33f 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -1620,9 +1620,7 @@ class Py24Test(CoverageTest):
"""Tests of new syntax in Python 2.4."""
def test_function_decorators(self) -> None:
- lines = [1, 2, 3, 4, 6, 8, 10, 12]
- if env.PYBEHAVIOR.trace_decorated_def:
- lines = sorted(lines + [9])
+ lines = [1, 2, 3, 4, 6, 8, 9, 10, 12]
self.check_coverage("""\
def require_int(func):
def wrapper(arg):
@@ -1640,9 +1638,7 @@ def p1(arg):
lines, "")
def test_function_decorators_with_args(self) -> None:
- lines = [1, 2, 3, 4, 5, 6, 8, 10, 12]
- if env.PYBEHAVIOR.trace_decorated_def:
- lines = sorted(lines + [9])
+ lines = [1, 2, 3, 4, 5, 6, 8, 9, 10, 12]
self.check_coverage("""\
def boost_by(extra):
def decorator(func):
@@ -1660,9 +1656,7 @@ def boosted(arg):
lines, "")
def test_double_function_decorators(self) -> None:
- lines = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 17, 19, 21, 22, 24, 26]
- if env.PYBEHAVIOR.trace_decorated_def:
- lines = sorted(lines + [16, 23])
+ lines = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 19, 21, 22, 23, 24, 26]
self.check_coverage("""\
def require_int(func):
def wrapper(arg):
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 8ff3226bc..5de9c420c 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -180,9 +180,7 @@ def meth(self):
def func(x=25):
return 26
""")
- raw_statements = {3, 4, 5, 6, 8, 9, 10, 13, 15, 16, 17, 20, 22, 23, 25, 26}
- if env.PYBEHAVIOR.trace_decorated_def:
- raw_statements.update({11, 19})
+ raw_statements = {3, 4, 5, 6, 8, 9, 10, 11, 13, 15, 16, 17, 19, 20, 22, 23, 25, 26}
assert parser.raw_statements == raw_statements
assert parser.statements == {8}
@@ -201,9 +199,7 @@ def f():
def g():
x = 9
""")
- raw_statements = {1, 2, 4, 6, 7, 9}
- if env.PYBEHAVIOR.trace_decorated_def:
- raw_statements.update({3, 8})
+ raw_statements = {1, 2, 3, 4, 6, 7, 8, 9}
assert parser.raw_statements == raw_statements
assert parser.statements == set()
@@ -235,14 +231,9 @@ def bar(self):
pass
""")
- if env.PYBEHAVIOR.trace_decorated_def:
- expected_statements = {1, 2, 4, 5, 8, 9, 10}
- expected_arcs = set(arcz_to_arcs(".1 14 45 58 89 9. .2 2. -8A A-8"))
- expected_exits = {1: 1, 2: 1, 4: 1, 5: 1, 8: 1, 9: 1, 10: 1}
- else:
- expected_statements = {1, 2, 4, 8, 10}
- expected_arcs = set(arcz_to_arcs(".1 14 48 8. .2 2. -8A A-8"))
- expected_exits = {1: 1, 2: 1, 4: 1, 8: 1, 10: 1}
+ expected_statements = {1, 2, 4, 5, 8, 9, 10}
+ expected_arcs = set(arcz_to_arcs(".1 14 45 58 89 9. .2 2. -8A A-8"))
+ expected_exits = {1: 1, 2: 1, 4: 1, 5: 1, 8: 1, 9: 1, 10: 1}
if env.PYBEHAVIOR.docstring_only_function:
# 3.7 changed how functions with only docstrings are numbered.
diff --git a/tests/test_report_common.py b/tests/test_report_common.py
index 685515172..69191e523 100644
--- a/tests/test_report_common.py
+++ b/tests/test_report_common.py
@@ -8,7 +8,6 @@
import textwrap
import coverage
-from coverage import env
from coverage.files import abs_file
from tests.coveragetest import CoverageTest
@@ -240,15 +239,13 @@ def test_xml(self) -> None:
cov.load()
cov.xml_report()
contains("coverage.xml", 'filename="good.j2"')
- if env.PYVERSION >= (3, 8): # Py3.7 puts attributes in the other order.
- contains("coverage.xml",
- '',
- '',
- '',
- )
+ contains("coverage.xml",
+ '',
+ '',
+ '',
+ )
doesnt_contain("coverage.xml", 'filename="bad.j2"')
- if env.PYVERSION >= (3, 8): # Py3.7 puts attributes in the other order.
- doesnt_contain("coverage.xml", ' None:
self.make_files()
From ebc2982cd106492e43f958567c2c6ffa5ddc4a56 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 17 Jun 2023 06:13:55 -0400
Subject: [PATCH 40/83] build: adjust the versions of PyPy
---
.github/workflows/coverage.yml | 13 ++++---------
.github/workflows/testsuite.yml | 1 +
tox.ini | 2 +-
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 1543d76db..ae159bff0 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -49,18 +49,13 @@ jobs:
- "3.11"
- "3.12"
- "pypy-3.8"
- - "pypy-3.9"
+ - "pypy-3.10"
exclude:
- # Windows PyPy doesn't seem to work?
- - os: windows-latest
- python-version: "pypy-3.8"
- - os: windows-latest
- python-version: "pypy-3.9"
# Mac PyPy always takes the longest, and doesn't add anything.
- - os: macos-latest
+ - os: macos
python-version: "pypy-3.8"
- - os: macos-latest
- python-version: "pypy-3.9"
+ - os: macos
+ python-version: "pypy-3.10"
# If one job fails, stop the whole thing.
fail-fast: true
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index 8d21c4131..e6e57ebee 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -52,6 +52,7 @@ jobs:
- "3.12"
- "pypy-3.8"
- "pypy-3.9"
+ - "pypy-3.10"
exclude:
# Windows PyPy-3.9 always gets killed.
- os: windows
diff --git a/tox.ini b/tox.ini
index aacc2fbeb..51fe5828c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,7 +26,7 @@ install_command = python -m pip install -U {opts} {packages}
passenv = *
setenv =
- pypy{3,37,38,39}: COVERAGE_NO_CTRACER=no C extension under PyPy
+ pypy{3,38,39,310}: COVERAGE_NO_CTRACER=no C extension under PyPy
# For some tests, we need .pyc files written in the current directory,
# so override any local setting.
PYTHONPYCACHEPREFIX=
From 513a19805c4d29f792f269ed30e6ff63ddc36fe6 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 17 Jun 2023 13:10:13 -0400
Subject: [PATCH 41/83] test: allow irrelevant __file__ differences
On PyPy3.10, test_coverage_run_far_away_is_like_python started failing due to
slash vs backslash differences. Rather than try to make coverage exactly
produce what PyPy does, I figured it was easier to ignore those differences
since the don't really matter.
---
.github/workflows/testsuite.yml | 4 ----
tests/modules/process_test/try_execfile.py | 2 +-
tests/test_process.py | 8 ++++++++
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index e6e57ebee..8f878e662 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -53,10 +53,6 @@ jobs:
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
- exclude:
- # Windows PyPy-3.9 always gets killed.
- - os: windows
- python-version: "pypy-3.9"
fail-fast: false
steps:
diff --git a/tests/modules/process_test/try_execfile.py b/tests/modules/process_test/try_execfile.py
index ad97a23b9..c3ed3e00c 100644
--- a/tests/modules/process_test/try_execfile.py
+++ b/tests/modules/process_test/try_execfile.py
@@ -87,7 +87,7 @@ def word_group(w: str) -> int:
globals_to_check = {
'os.getcwd': os.getcwd(),
'__name__': __name__,
- '__file__': __file__,
+ '__file__': os.path.normcase(__file__),
'__doc__': __doc__,
'__builtins__.has_open': hasattr(__builtins__, 'open'),
'__builtins__.dir': builtin_dir,
diff --git a/tests/test_process.py b/tests/test_process.py
index e06b86f5d..a3f8dbb4a 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -688,6 +688,14 @@ def test_coverage_run_far_away_is_like_python(self) -> None:
actual = self.run_command("coverage run sub/overthere/prog.py")
self.assert_tryexecfile_output(expected, actual)
+ @pytest.mark.skipif(not env.WINDOWS, reason="This is about Windows paths")
+ def test_coverage_run_far_away_is_like_python_windows(self) -> None:
+ with open(TRY_EXECFILE) as f:
+ self.make_file("sub/overthere/prog.py", f.read())
+ expected = self.run_command("python sub\\overthere\\prog.py")
+ actual = self.run_command("coverage run sub\\overthere\\prog.py")
+ self.assert_tryexecfile_output(expected, actual)
+
def test_coverage_run_dashm_is_like_python_dashm(self) -> None:
# These -m commands assume the coverage tree is on the path.
expected = self.run_command("python -m process_test.try_execfile")
From 76b9a2c735309748a7fea6562439ed0be4130e7e Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 17 Jun 2023 13:44:59 -0400
Subject: [PATCH 42/83] test: process_ram on Windows was only working on 3.7
---
tests/osinfo.py | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/tests/osinfo.py b/tests/osinfo.py
index 4d11ce73c..f55fe88c1 100644
--- a/tests/osinfo.py
+++ b/tests/osinfo.py
@@ -13,12 +13,14 @@
def process_ram() -> int:
"""How much RAM is this process using? (Windows)"""
import ctypes
+ from ctypes import wintypes
# From: http://lists.ubuntu.com/archives/bazaar-commits/2009-February/011990.html
+ # Updated from: https://stackoverflow.com/a/16204942/14343
class PROCESS_MEMORY_COUNTERS_EX(ctypes.Structure):
"""Used by GetProcessMemoryInfo"""
_fields_ = [
- ('cb', ctypes.c_ulong),
- ('PageFaultCount', ctypes.c_ulong),
+ ('cb', wintypes.DWORD),
+ ('PageFaultCount', wintypes.DWORD),
('PeakWorkingSetSize', ctypes.c_size_t),
('WorkingSetSize', ctypes.c_size_t),
('QuotaPeakPagedPoolUsage', ctypes.c_size_t),
@@ -30,15 +32,27 @@ class PROCESS_MEMORY_COUNTERS_EX(ctypes.Structure):
('PrivateUsage', ctypes.c_size_t),
]
- mem_struct = PROCESS_MEMORY_COUNTERS_EX()
- ret = ctypes.windll.psapi.GetProcessMemoryInfo(
- ctypes.windll.kernel32.GetCurrentProcess(),
- ctypes.byref(mem_struct),
- ctypes.sizeof(mem_struct)
+ GetProcessMemoryInfo = ctypes.windll.psapi.GetProcessMemoryInfo
+ GetProcessMemoryInfo.argtypes = [
+ wintypes.HANDLE,
+ ctypes.POINTER(PROCESS_MEMORY_COUNTERS_EX),
+ wintypes.DWORD,
+ ]
+ GetProcessMemoryInfo.restype = wintypes.BOOL
+
+ GetCurrentProcess = ctypes.windll.kernel32.GetCurrentProcess
+ GetCurrentProcess.argtypes = []
+ GetCurrentProcess.restype = wintypes.HANDLE
+
+ counters = PROCESS_MEMORY_COUNTERS_EX()
+ ret = GetProcessMemoryInfo(
+ GetCurrentProcess(),
+ ctypes.byref(counters),
+ ctypes.sizeof(counters),
)
if not ret: # pragma: part covered
return 0 # pragma: cant happen
- return mem_struct.PrivateUsage
+ return counters.PrivateUsage
elif sys.platform.startswith("linux"):
# Linux implementation
From 93fd1528fe087c9e1486b43e059559505da323da Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 17 Jun 2023 15:28:28 -0400
Subject: [PATCH 43/83] docs: updated tox example
---
doc/contributing.rst | 72 ++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/doc/contributing.rst b/doc/contributing.rst
index 82e6d069b..f95c52f6e 100644
--- a/doc/contributing.rst
+++ b/doc/contributing.rst
@@ -63,45 +63,45 @@ Running the tests
The tests are written mostly as standard unittest-style tests, and are run with
pytest running under `tox`_::
- % python3 -m tox
+ % python -m tox -e py38
ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions
- .pkg: _optional_hooks> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- .pkg: get_requires_for_build_editable> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- .pkg: build_editable> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- py37: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/87/coverage-7.2.3a0.dev1-0.editable-cp37-cp37m-macosx_10_15_x86_64.whl
- py37: commands[0]> python igor.py zip_mods
- py37: commands[1]> python setup.py --quiet build_ext --inplace
- py37: commands[2]> python -m pip install -q -e .
- py37: commands[3]> python igor.py test_with_tracer c
- === CPython 3.7.15 with C tracer (.tox/py37/bin/python) ===
+ .pkg: _optional_hooks> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
+ .pkg: get_requires_for_build_editable> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
+ .pkg: build_editable> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
+ py38: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/53/coverage-7.2.8a0.dev1-0.editable-cp38-cp38-macosx_13_0_x86_64.whl
+ py38: commands[0]> python igor.py zip_mods
+ py38: commands[1]> python setup.py --quiet build_ext --inplace
+ py38: commands[2]> python -m pip install -q -e .
+ py38: commands[3]> python igor.py test_with_tracer c
+ === CPython 3.8.17 with C tracer (.tox/py38/bin/python) ===
bringing up nodes...
- .........................................................................................................................x.................s....s....... [ 11%]
- ..s.....x.............................................s................................................................................................. [ 22%]
- ........................................................................................................................................................ [ 34%]
- ........................................................................................................................................................ [ 45%]
- ........................................................................................................................................................ [ 57%]
- .........s....................................................................................................................s......................... [ 68%]
- .................................s..............................s...............s..................................s.................................... [ 80%]
- ........................................................s............................................................................................... [ 91%]
- ......................................s......................................................................... [100%]
- 1316 passed, 12 skipped, 2 xfailed in 36.42s
- py37: commands[4]> python igor.py remove_extension
- py37: commands[5]> python igor.py test_with_tracer py
- === CPython 3.7.15 with Python tracer (.tox/py37/bin/python) ===
+ s................................................................................................................x..................ss..x................. [ 11%]
+ ............s....................s........................................................................................................................ [ 22%]
+ .......................................................................................................................................................... [ 34%]
+ .....................................................................................................................................s.................... [ 45%]
+ .......................................................................................s.................................................................. [ 57%]
+ .....................................................................s.................................................................................... [ 68%]
+ ..........s..........................................................s.................................................................................... [ 79%]
+ .............................................................................s............................................s...s........................... [ 91%]
+ ...................................................................................................s................ [100%]
+ 1332 passed, 14 skipped, 2 xfailed in 35.46s
+ py38: commands[4]> python igor.py remove_extension
+ py38: commands[5]> python igor.py test_with_tracer py
+ === CPython 3.8.17 with Python tracer (.tox/py38/bin/python) ===
bringing up nodes...
- ................................................................................................x...........................x.................s......... [ 11%]
- .....s.............s.s.....................................................s..............ss............................s.ss....ss.ss................... [ 22%]
- ......................................................................................................................................s................. [ 34%]
- ..................................................................................................................s..................................... [ 45%]
- ...................s.ss.....................................................................................s....................s.ss................... [ 57%]
- ..................s.s................................................................................................................................... [ 68%]
- ..........................s.........................................ssss...............s.................s...sss..................s...ss...ssss.s....... [ 80%]
- .......................................................................................................................................................s [ 91%]
- .........................................................................s.................................ss.... [100%]
- 1281 passed, 47 skipped, 2 xfailed in 33.86s
- .pkg: _exit> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- py37: OK (82.38=setup[2.80]+cmd[0.20,0.35,7.30,37.20,0.21,34.32] seconds)
- congratulations :) (83.61 seconds)
+ .................................................................................................x...x..............................ss.................... [ 11%]
+ ..................................s..................................s..........................s.ss.....ss.............s.s............s..s.............s. [ 22%]
+ .......................................................................................................................................................... [ 34%]
+ .................................s...........ss..s........................................................................................................ [ 45%]
+ ...s.......................................................................................s...........................................................s.. [ 57%]
+ ......s......................................................ss.s.........................................................................s..............s [ 68%]
+ ................ssss...................sss.ss..........................................................................................sssss.sss.......... [ 80%]
+ .....................................................................................................................s........s........................... [ 91%]
+ ......................................s.....................................................................ss...... [100%]
+ 1297 passed, 49 skipped, 2 xfailed in 35.68s
+ .pkg: _exit> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
+ py38: OK (88.47=setup[3.68]+cmd[0.38,1.11,5.89,38.63,0.26,38.53] seconds)
+ congratulations :) (89.51 seconds)
Tox runs the complete test suite twice for each version of Python you have
installed. The first run uses the C implementation of the trace function,
From 0f25770f11be3ddb32a576ac646fb0ff2bad547d Mon Sep 17 00:00:00 2001
From: "Edgar R. M"
Date: Sun, 18 Jun 2023 05:43:50 -0600
Subject: [PATCH 44/83] build: make wheel for PyPy 3.8-3.10 (#1645)
---
.github/workflows/kit.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index dbc1a4bbb..9dc2f4359 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -234,7 +234,7 @@ jobs:
run: |
# One wheel works for all PyPy versions. PYVERSIONS
# yes, this is weird syntax: https://github.com/pypa/build/issues/202
- pypy3 -m build -w -C="--global-option=--python-tag" -C="--global-option=pp38.pp39"
+ pypy3 -m build -w -C="--global-option=--python-tag" -C="--global-option=pp38.pp39.pp310"
- name: "List wheels"
run: |
From 13eb95f09e3bb01dd8aae69c2ee3fb4d80fede36 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 18 Jun 2023 13:14:32 -0400
Subject: [PATCH 45/83] chore: make doc_upgrade
---
doc/requirements.pip | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/requirements.pip b/doc/requirements.pip
index ff6278bfb..ec756bc80 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -66,7 +66,7 @@ sphinx-autobuild==2021.3.14
# via -r doc/requirements.in
sphinx-code-tabs==0.5.3
# via -r doc/requirements.in
-sphinx-rtd-theme==1.2.1
+sphinx-rtd-theme==1.2.2
# via -r doc/requirements.in
sphinxcontrib-applehelp==1.0.4
# via sphinx
@@ -86,5 +86,5 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
tornado==6.3.2
# via livereload
-urllib3==2.0.2
+urllib3==2.0.3
# via requests
From a688f3d9ab8b1e81d93ce33a9766e2026471a38c Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 18 Jun 2023 13:15:17 -0400
Subject: [PATCH 46/83] =?UTF-8?q?docs:=20thanks,=20Edgar=20Ram=C3=ADrez=20?=
=?UTF-8?q?Mondrag=C3=B3n=20for=20#1645?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
commit 0f25770f
---
CONTRIBUTORS.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index dcf651ae8..b5bd4e489 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -73,6 +73,7 @@ Devin Jeanpierre
Dirk Thomas
Dmitry Shishov
Dmitry Trofimov
+Edgar Ramírez Mondragón
Eduardo Schettino
Edward Loper
Eli Skeggs
From c6b1886d7530c19be0b5ed7ed47b118f1a81c70d Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 18 Jun 2023 13:17:06 -0400
Subject: [PATCH 47/83] style: oops, remove commented-out code.
---
coverage/parser.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/coverage/parser.py b/coverage/parser.py
index 00a3b75bb..6782a1989 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -1028,10 +1028,6 @@ def _handle_decorated(self, node: ast.FunctionDef) -> Set[ArcStart]:
if node.body:
body_start = self.line_for_node(node.body[0])
body_start = self.multiline.get(body_start, body_start)
- # for lineno in range(last+1, body_start):
- # if lineno in self.statements:
- # self.add_arc(last, lineno)
- # last = lineno
# The body is handled in collect_arcs.
assert last is not None
return {ArcStart(last)}
From 4527c34f7161648c04bf787714aff99981b53aa5 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 18 Jun 2023 13:17:34 -0400
Subject: [PATCH 48/83] docs: update commands for the move away from 3.7
---
Makefile | 2 +-
README.rst | 2 +-
doc/contributing.rst | 100 +++++++++++++++++++++++++++----------------
doc/index.rst | 4 +-
doc/install.rst | 2 +-
5 files changed, 67 insertions(+), 43 deletions(-)
diff --git a/Makefile b/Makefile
index 3ccb7e76b..9fc5a234a 100644
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,7 @@ lint: ## Run linters and checkers.
PYTEST_SMOKE_ARGS = -n auto -m "not expensive" --maxfail=3 $(ARGS)
smoke: ## Run tests quickly with the C tracer in the lowest supported Python versions.
- COVERAGE_NO_PYTRACER=1 tox -q -e py37 -- $(PYTEST_SMOKE_ARGS)
+ COVERAGE_NO_PYTRACER=1 tox -q -e py38 -- $(PYTEST_SMOKE_ARGS)
##@ Metacov: coverage measurement of coverage.py itself
diff --git a/README.rst b/README.rst
index 87bbead7b..4216e69a4 100644
--- a/README.rst
+++ b/README.rst
@@ -29,7 +29,7 @@ Coverage.py runs on these versions of Python:
.. PYVERSIONS
* CPython 3.8 through 3.12.0b2
-* PyPy3 7.3.11.
+* PyPy3 versions 3.8 through 3.10.
Documentation is on `Read the Docs`_. Code repository and issue tracker are on
`GitHub`_.
diff --git a/doc/contributing.rst b/doc/contributing.rst
index f95c52f6e..1816e979a 100644
--- a/doc/contributing.rst
+++ b/doc/contributing.rst
@@ -1,6 +1,8 @@
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+.. Command samples here were made with a 100-column terminal.
+
.. _contributing:
===========================
@@ -9,9 +11,10 @@ Contributing to coverage.py
.. highlight:: console
-I welcome contributions to coverage.py. Over the years, dozens of people have
-provided patches of various sizes to add features or fix bugs. This page
-should have all the information you need to make a contribution.
+I welcome contributions to coverage.py. Over the years, hundreds of people
+have provided contributions of various sizes to add features, fix bugs, or just
+help diagnose thorny issues. This page should have all the information you
+need to make a contribution.
One source of history or ideas are the `bug reports`_ against coverage.py.
There you can find ideas for requested features, or the remains of rejected
@@ -63,45 +66,64 @@ Running the tests
The tests are written mostly as standard unittest-style tests, and are run with
pytest running under `tox`_::
- % python -m tox -e py38
+ $ python3 -m tox -e py38
ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions
+ py38: wheel-0.40.0-py3-none-any.whl already present in /Users/nedbatchelder/Library/Application Support/virtualenv/wheel/3.8/embed/3/wheel.json
+ py38: pip-23.1.2-py3-none-any.whl already present in /Users/nedbatchelder/Library/Application Support/virtualenv/wheel/3.8/embed/3/pip.json
+ py38: setuptools-67.8.0-py3-none-any.whl already present in /Users/nedbatchelder/Library/Application Support/virtualenv/wheel/3.8/embed/3/setuptools.json
+ py38: install_deps> python -m pip install -U -r requirements/pip.pip -r requirements/pytest.pip -r requirements/light-threads.pip
+ .pkg: install_requires> python -I -m pip install setuptools
.pkg: _optional_hooks> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
+ .pkg: install_requires_for_build_editable> python -I -m pip install wheel
.pkg: build_editable> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- py38: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/53/coverage-7.2.8a0.dev1-0.editable-cp38-cp38-macosx_13_0_x86_64.whl
+ py38: install_package_deps> python -m pip install -U 'tomli; python_full_version <= "3.11.0a6"'
+ py38: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/1/coverage-7.2.8a0.dev1-0.editable-cp38-cp38-macosx_13_0_x86_64.whl
py38: commands[0]> python igor.py zip_mods
py38: commands[1]> python setup.py --quiet build_ext --inplace
py38: commands[2]> python -m pip install -q -e .
py38: commands[3]> python igor.py test_with_tracer c
=== CPython 3.8.17 with C tracer (.tox/py38/bin/python) ===
bringing up nodes...
- s................................................................................................................x..................ss..x................. [ 11%]
- ............s....................s........................................................................................................................ [ 22%]
- .......................................................................................................................................................... [ 34%]
- .....................................................................................................................................s.................... [ 45%]
- .......................................................................................s.................................................................. [ 57%]
- .....................................................................s.................................................................................... [ 68%]
- ..........s..........................................................s.................................................................................... [ 79%]
- .............................................................................s............................................s...s........................... [ 91%]
- ...................................................................................................s................ [100%]
- 1332 passed, 14 skipped, 2 xfailed in 35.46s
+ ............................................................................................ [ 6%]
+ ...................................x.....x...............s..s..s.s.......................... [ 13%]
+ ............................................................................................ [ 20%]
+ ............................................................................................ [ 27%]
+ ............................................................................................ [ 34%]
+ ............................................................................................ [ 41%]
+ ............................................................................................ [ 47%]
+ ............................................................................................ [ 54%]
+ ........................................................s...........s....................... [ 61%]
+ ............................................................................................ [ 68%]
+ ..........s...........................s...........s......................................... [ 75%]
+ ..................s...................s..............................................s...... [ 82%]
+ ...............................s............................................................ [ 88%]
+ ............................................................................................ [ 95%]
+ .............................s............................. [100%]
+ 1332 passed, 14 skipped, 2 xfailed in 60.54s (0:01:00)
py38: commands[4]> python igor.py remove_extension
py38: commands[5]> python igor.py test_with_tracer py
=== CPython 3.8.17 with Python tracer (.tox/py38/bin/python) ===
bringing up nodes...
- .................................................................................................x...x..............................ss.................... [ 11%]
- ..................................s..................................s..........................s.ss.....ss.............s.s............s..s.............s. [ 22%]
- .......................................................................................................................................................... [ 34%]
- .................................s...........ss..s........................................................................................................ [ 45%]
- ...s.......................................................................................s...........................................................s.. [ 57%]
- ......s......................................................ss.s.........................................................................s..............s [ 68%]
- ................ssss...................sss.ss..........................................................................................sssss.sss.......... [ 80%]
- .....................................................................................................................s........s........................... [ 91%]
- ......................................s.....................................................................ss...... [100%]
- 1297 passed, 49 skipped, 2 xfailed in 35.68s
+ ............................................................................................ [ 6%]
+ .............................x.............................................................. [ 13%]
+ ..ss...................................x.....................................ss............. [ 20%]
+ ..........s.....................................ss...................s.................sss.. [ 27%]
+ .ss.....s................................................................................... [ 34%]
+ ............................................................................................ [ 41%]
+ ....................................................................s....................... [ 47%]
+ .....................................................................s..s.ss................ [ 54%]
+ ...ss.sss.......................................................s........s........sss....... [ 61%]
+ .ss...............s.s..................s.................s.s................................ [ 68%]
+ ...........................................................................................s [ 75%]
+ ........................................................s.......................s........... [ 82%]
+ ....................ss.s........................ssss........................................ [ 88%]
+ ............................................................................................ [ 95%]
+ ................................s...............ss......... [100%]
+ 1297 passed, 49 skipped, 2 xfailed in 44.59s
.pkg: _exit> python /usr/local/virtualenvs/coverage/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta
- py38: OK (88.47=setup[3.68]+cmd[0.38,1.11,5.89,38.63,0.26,38.53] seconds)
- congratulations :) (89.51 seconds)
+ py38: OK (143.82=setup[23.23]+cmd[0.29,1.60,8.43,61.64,0.34,48.28] seconds)
+ congratulations :) (144.93 seconds)
Tox runs the complete test suite twice for each version of Python you have
installed. The first run uses the C implementation of the trace function,
@@ -109,7 +131,7 @@ the second uses the Python implementation.
To limit tox to just a few versions of Python, use the ``-e`` switch::
- $ python3 -m tox -e py37,py39
+ $ python3 -m tox -e py38,py39
On the tox command line, options after ``--`` are passed to pytest. To run
just a few tests, you can use `pytest test selectors`_::
@@ -123,14 +145,16 @@ respectively. The pytest ``-k`` option selects tests based on a word in their
name, which can be very convenient for ad-hoc test selection. Of course you
can combine tox and pytest options::
- $ python3 -m tox -q -e py37 -- -n 0 -vv -k hash
- === CPython 3.7.15 with C tracer (.tox/py37/bin/python) ===
+ $ python3 -m tox -q -e py310 -- -n 0 -vv -k hash
+ === CPython 3.10.12 with C tracer (.tox/py310/bin/python) ===
======================================= test session starts ========================================
- platform darwin -- Python 3.7.15, pytest-7.2.2, pluggy-1.0.0 -- /Users/nedbat/coverage/.tox/py37/bin/python
- cachedir: .tox/py37/.pytest_cache
- rootdir: /Users/nedbat/coverage, configfile: setup.cfg
- plugins: flaky-3.7.0, hypothesis-6.70.0, xdist-3.2.1
- collected 1330 items / 1320 deselected / 10 selected
+ platform darwin -- Python 3.10.12, pytest-7.3.2, pluggy-1.0.0 -- /Users/nedbatchelder/coverage/trunk/.tox/py310/bin/python
+ cachedir: .tox/py310/.pytest_cache
+ hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/Users/nedbatchelder/coverage/trunk/.hypothesis/examples')
+ rootdir: /Users/nedbatchelder/coverage/trunk
+ configfile: pyproject.toml
+ plugins: hypothesis-6.78.3, flaky-3.7.0, xdist-3.3.1
+ collected 1348 items / 1338 deselected / 10 selected
run-last-failure: no previously failed tests, not deselecting items.
tests/test_data.py::CoverageDataTest::test_add_to_hash_with_lines PASSED [ 10%]
@@ -144,10 +168,10 @@ can combine tox and pytest options::
tests/test_misc.py::HasherTest::test_dict_hashing PASSED [ 90%]
tests/test_misc.py::HasherTest::test_dict_collision PASSED [100%]
- =============================== 10 passed, 1320 deselected in 1.88s ================================
+ =============================== 10 passed, 1338 deselected in 2.24s ================================
Skipping tests with Python tracer: Only one tracer: no Python tracer for CPython
- py37: OK (12.22=setup[2.19]+cmd[0.20,0.36,6.57,2.51,0.20,0.19] seconds)
- congratulations :) (13.10 seconds)
+ py310: OK (17.99 seconds)
+ congratulations :) (19.09 seconds)
You can also affect the test runs with environment variables. Define any of
these as 1 to use them:
diff --git a/doc/index.rst b/doc/index.rst
index 24ebb6d32..f2b6e096a 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -17,7 +17,7 @@ The latest version is coverage.py |release|, released |release_date|. It is
supported on:
* Python versions 3.8 through 3.12.0b2.
-* PyPy3 7.3.11.
+* PyPy3 versions 3.8 through 3.10.
.. PYVERSIONS
@@ -92,7 +92,7 @@ Getting started is easy:
Change "python" to "coverage run", so this::
- $ python -m unittest discover
+ $ python3 -m unittest discover
becomes::
diff --git a/doc/install.rst b/doc/install.rst
index 1b940b4bb..6cc4e9709 100644
--- a/doc/install.rst
+++ b/doc/install.rst
@@ -84,6 +84,6 @@ You can also invoke coverage.py as a module:
.. parsed-literal::
- $ python -m coverage --version
+ $ python3 -m coverage --version
Coverage.py, version |release| with C extension
Documentation at |doc-url|
From a5f37e0ba1d00329d4e8aa68e3d17478feca157c Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Mon, 19 Jun 2023 22:04:00 -0400
Subject: [PATCH 49/83] test: remove a surprising remnant of Python 2
---
tests/gold/html/bom/bom_py.html | 28 +++++++++++-----------------
tests/gold/html/bom/index.html | 22 +++++++++++-----------
tests/test_html.py | 12 +++---------
3 files changed, 25 insertions(+), 37 deletions(-)
diff --git a/tests/gold/html/bom/bom_py.html b/tests/gold/html/bom/bom_py.html
index eaea085f5..187fd5235 100644
--- a/tests/gold/html/bom/bom_py.html
+++ b/tests/gold/html/bom/bom_py.html
@@ -2,7 +2,7 @@
- Codestin Search App
+ Codestin Search App
@@ -12,7 +12,7 @@
Coverage for bom.py:
- 71%
+ 100%
- 7 statements
-
-
+ 3 statements
+
+
@@ -64,8 +64,8 @@