From a56705780ab1f807ccebd416dc06166a89a288a2 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 16 Mar 2023 10:46:39 -0400 Subject: [PATCH 01/39] 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 209eb6ad8..c139d6c91 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-2: diff --git a/coverage/version.py b/coverage/version.py index c9e8d7f7e..ace1d2595 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, 2, "final", 0) -_dev = 0 +version_info = (7, 2, 3, "alpha", 0) +_dev = 1 def _make_version( From 98d410af8430d427675742e6ad88ff95aa029407 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 16 Mar 2023 08:01:49 -0400 Subject: [PATCH 02/39] build: slightly more release automation --- Makefile | 9 +++++++++ howto.txt | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7f6959208..ce3772c82 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,15 @@ REPO_OWNER = nedbat/coveragepy edit_for_release: ## Edit sources to insert release facts. python igor.py edit_for_release +relbranch: ## Create the branch for releasing. + echo git switch -c nedbat/release-$$(date +%Y%m%d) + +relcommit1: ## Commit the first release changes. + git commit -am "docs: prep for $$(python setup.py --version)" + +relcommit2: ## Commit the latest sample HTML report. + git commit -am "docs: sample HTML for $$(python setup.py --version)" + kit: ## Make the source distribution. python -m build diff --git a/howto.txt b/howto.txt index b0d58c625..4125ec77e 100644 --- a/howto.txt +++ b/howto.txt @@ -2,6 +2,7 @@ - Check that the current virtualenv matches the current coverage branch. - start branch for release work + $ make relbranch - Version number in coverage/version.py version_info = (4, 0, 2, "alpha", 1) version_info = (4, 0, 2, "beta", 1) @@ -26,12 +27,14 @@ - Check that the docs build correctly: $ tox -e doc - commit the release-prep changes + $ make relcommit1 - Generate new sample_html to get the latest, incl footer version number: - IF PRE-RELEASE: $ make sample_html_beta - IF NOT PRE-RELEASE: $ make sample_html - check in the new sample html + - check in the new sample html + $ make relcommit2 - Done with changes to source files - check them in on the release prep branch - wait for ci to finish From 83857010d479c209385baea72dcebc76f0ca668a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 16 Mar 2023 11:44:17 -0400 Subject: [PATCH 03/39] chore: make upgrade --- doc/requirements.pip | 15 ++++----------- requirements/dev.pip | 12 ++++++------ requirements/kit.pip | 12 ++++++------ requirements/lint.pip | 20 ++++++++++---------- requirements/mypy.pip | 6 +++--- requirements/pip-tools.pip | 6 +++--- requirements/pip.pip | 6 +++--- requirements/pytest.pip | 6 +++--- requirements/tox.pip | 6 +++--- 9 files changed, 41 insertions(+), 48 deletions(-) diff --git a/doc/requirements.pip b/doc/requirements.pip index 5ef2a81b2..a3d5bb388 100644 --- a/doc/requirements.pip +++ b/doc/requirements.pip @@ -243,6 +243,7 @@ sphinx==5.3.0 \ # -r doc/requirements.in # sphinx-autobuild # sphinx-rtd-theme + # sphinxcontrib-jquery # sphinxcontrib-restbuilder # sphinxcontrib-spelling sphinx-autobuild==2021.3.14 \ @@ -265,9 +266,9 @@ sphinxcontrib-htmlhelp==2.0.0 \ --hash=sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07 \ --hash=sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2 # via sphinx -sphinxcontrib-jquery==2.0.0 \ - --hash=sha256:8fb65f6dba84bf7bcd1aea1f02ab3955ac34611d838bcc95d4983b805b234daa \ - --hash=sha256:ed47fa425c338ffebe3c37e1cdb56e30eb806116b85f01055b158c7057fdb995 +sphinxcontrib-jquery==4.1 \ + --hash=sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a \ + --hash=sha256:f936030d7d0147dd026a4f2b5a57343d233f1fc7b363f68b3d4f1cb0993878ae # via sphinx-rtd-theme sphinxcontrib-jsmath==1.0.1 \ --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ @@ -314,11 +315,3 @@ zipp==3.15.0 \ --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -setuptools==65.7.0 \ - --hash=sha256:4d3c92fac8f1118bb77a22181355e29c239cabfe2b9effdaa665c66b711136d7 \ - --hash=sha256:8ab4f1dbf2b4a65f7eec5ad0c620e84c34111a68d3349833494b9088212214dd - # via - # -c doc/../requirements/pins.pip - # sphinxcontrib-jquery diff --git a/requirements/dev.pip b/requirements/dev.pip index 03540351d..fb94546ac 100644 --- a/requirements/dev.pip +++ b/requirements/dev.pip @@ -148,9 +148,9 @@ execnet==1.9.0 \ --hash=sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5 \ --hash=sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142 # via pytest-xdist -filelock==3.9.0 \ - --hash=sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de \ - --hash=sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 # via # tox # virtualenv @@ -220,9 +220,9 @@ greenlet==2.0.2 \ --hash=sha256:f82d4d717d8ef19188687aa32b8363e96062911e63ba22a0cff7802a8e58e5f1 \ --hash=sha256:fc3a569657468b6f3fb60587e48356fe512c1754ca05a564f11366ac9e306526 # via -r requirements/dev.in -hypothesis==6.68.2 \ - --hash=sha256:2a41cc766cde52705895e54547374af89c617e8ec7bc4186cb7f03884a667d4e \ - --hash=sha256:a7eb2b0c9a18560d8197fe35047ceb58e7e8ab7623a3e5a82613f6a2cd71cffa +hypothesis==6.70.0 \ + --hash=sha256:be395f71d6337a5e8ed2f695c568360a686056c3b00c98bd818874c674b24586 \ + --hash=sha256:f5cae09417d0ffc7711f602cdcfa3b7baf344597a672a84658186605b04f4a4f # via -r requirements/pytest.in idna==3.4 \ --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ diff --git a/requirements/kit.pip b/requirements/kit.pip index 6a03f7a1e..b8e402844 100644 --- a/requirements/kit.pip +++ b/requirements/kit.pip @@ -32,9 +32,9 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via -r requirements/kit.in -filelock==3.9.0 \ - --hash=sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de \ - --hash=sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 # via cibuildwheel importlib-metadata==6.0.0 \ --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ @@ -74,9 +74,9 @@ typing-extensions==4.5.0 \ # cibuildwheel # importlib-metadata # platformdirs -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 +wheel==0.40.0 \ + --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ + --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 # via -r requirements/kit.in zipp==3.15.0 \ --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ diff --git a/requirements/lint.pip b/requirements/lint.pip index 6e04da410..1a19210d3 100644 --- a/requirements/lint.pip +++ b/requirements/lint.pip @@ -173,9 +173,9 @@ execnet==1.9.0 \ --hash=sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5 \ --hash=sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142 # via pytest-xdist -filelock==3.9.0 \ - --hash=sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de \ - --hash=sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 # via # tox # virtualenv @@ -245,9 +245,9 @@ greenlet==2.0.2 \ --hash=sha256:f82d4d717d8ef19188687aa32b8363e96062911e63ba22a0cff7802a8e58e5f1 \ --hash=sha256:fc3a569657468b6f3fb60587e48356fe512c1754ca05a564f11366ac9e306526 # via -r requirements/dev.in -hypothesis==6.68.2 \ - --hash=sha256:2a41cc766cde52705895e54547374af89c617e8ec7bc4186cb7f03884a667d4e \ - --hash=sha256:a7eb2b0c9a18560d8197fe35047ceb58e7e8ab7623a3e5a82613f6a2cd71cffa +hypothesis==6.70.0 \ + --hash=sha256:be395f71d6337a5e8ed2f695c568360a686056c3b00c98bd818874c674b24586 \ + --hash=sha256:f5cae09417d0ffc7711f602cdcfa3b7baf344597a672a84658186605b04f4a4f # via -r requirements/pytest.in idna==3.4 \ --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ @@ -546,6 +546,7 @@ sphinx==5.3.0 \ # -r doc/requirements.in # sphinx-autobuild # sphinx-rtd-theme + # sphinxcontrib-jquery # sphinxcontrib-restbuilder # sphinxcontrib-spelling sphinx-autobuild==2021.3.14 \ @@ -568,9 +569,9 @@ sphinxcontrib-htmlhelp==2.0.0 \ --hash=sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07 \ --hash=sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2 # via sphinx -sphinxcontrib-jquery==2.0.0 \ - --hash=sha256:8fb65f6dba84bf7bcd1aea1f02ab3955ac34611d838bcc95d4983b805b234daa \ - --hash=sha256:ed47fa425c338ffebe3c37e1cdb56e30eb806116b85f01055b158c7057fdb995 +sphinxcontrib-jquery==4.1 \ + --hash=sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a \ + --hash=sha256:f936030d7d0147dd026a4f2b5a57343d233f1fc7b363f68b3d4f1cb0993878ae # via sphinx-rtd-theme sphinxcontrib-jsmath==1.0.1 \ --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ @@ -791,4 +792,3 @@ setuptools==65.7.0 \ # -c requirements/pins.pip # -r requirements/pip.in # check-manifest - # sphinxcontrib-jquery diff --git a/requirements/mypy.pip b/requirements/mypy.pip index d34a39024..0f8aa4b27 100644 --- a/requirements/mypy.pip +++ b/requirements/mypy.pip @@ -28,9 +28,9 @@ flaky==3.7.0 \ --hash=sha256:3ad100780721a1911f57a165809b7ea265a7863305acb66708220820caf8aa0d \ --hash=sha256:d6eda73cab5ae7364504b7c44670f70abed9e75f77dd116352f662817592ec9c # via -r requirements/pytest.in -hypothesis==6.68.2 \ - --hash=sha256:2a41cc766cde52705895e54547374af89c617e8ec7bc4186cb7f03884a667d4e \ - --hash=sha256:a7eb2b0c9a18560d8197fe35047ceb58e7e8ab7623a3e5a82613f6a2cd71cffa +hypothesis==6.70.0 \ + --hash=sha256:be395f71d6337a5e8ed2f695c568360a686056c3b00c98bd818874c674b24586 \ + --hash=sha256:f5cae09417d0ffc7711f602cdcfa3b7baf344597a672a84658186605b04f4a4f # via -r requirements/pytest.in importlib-metadata==6.0.0 \ --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ diff --git a/requirements/pip-tools.pip b/requirements/pip-tools.pip index c68214c3e..aed2efc7b 100644 --- a/requirements/pip-tools.pip +++ b/requirements/pip-tools.pip @@ -40,9 +40,9 @@ typing-extensions==4.5.0 \ --hash=sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb \ --hash=sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4 # via importlib-metadata -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 +wheel==0.40.0 \ + --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ + --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 # via pip-tools zipp==3.15.0 \ --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ diff --git a/requirements/pip.pip b/requirements/pip.pip index 133754b77..7427f804f 100644 --- a/requirements/pip.pip +++ b/requirements/pip.pip @@ -8,9 +8,9 @@ distlib==0.3.6 \ --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \ --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e # via virtualenv -filelock==3.9.0 \ - --hash=sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de \ - --hash=sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 # via virtualenv importlib-metadata==6.0.0 \ --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ diff --git a/requirements/pytest.pip b/requirements/pytest.pip index 23abfc236..3171df182 100644 --- a/requirements/pytest.pip +++ b/requirements/pytest.pip @@ -28,9 +28,9 @@ flaky==3.7.0 \ --hash=sha256:3ad100780721a1911f57a165809b7ea265a7863305acb66708220820caf8aa0d \ --hash=sha256:d6eda73cab5ae7364504b7c44670f70abed9e75f77dd116352f662817592ec9c # via -r requirements/pytest.in -hypothesis==6.68.2 \ - --hash=sha256:2a41cc766cde52705895e54547374af89c617e8ec7bc4186cb7f03884a667d4e \ - --hash=sha256:a7eb2b0c9a18560d8197fe35047ceb58e7e8ab7623a3e5a82613f6a2cd71cffa +hypothesis==6.70.0 \ + --hash=sha256:be395f71d6337a5e8ed2f695c568360a686056c3b00c98bd818874c674b24586 \ + --hash=sha256:f5cae09417d0ffc7711f602cdcfa3b7baf344597a672a84658186605b04f4a4f # via -r requirements/pytest.in importlib-metadata==6.0.0 \ --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ diff --git a/requirements/tox.pip b/requirements/tox.pip index e1cd1e1ca..73831b7a4 100644 --- a/requirements/tox.pip +++ b/requirements/tox.pip @@ -22,9 +22,9 @@ distlib==0.3.6 \ --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \ --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e # via virtualenv -filelock==3.9.0 \ - --hash=sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de \ - --hash=sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 # via # tox # virtualenv From 02b759919323a5e6c664a9a3ef3468234997f5a9 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 16 Mar 2023 11:55:42 -0400 Subject: [PATCH 04/39] build: more conventional job names for kit.yml --- .github/workflows/kit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml index fd1b3a307..ec3750e68 100644 --- a/.github/workflows/kit.yml +++ b/.github/workflows/kit.yml @@ -47,7 +47,7 @@ concurrency: jobs: wheels: - name: "Build ${{ matrix.os }} ${{ matrix.py }} ${{ matrix.arch }} wheels" + name: "${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }} wheels" runs-on: ${{ matrix.os }}-latest strategy: matrix: @@ -177,7 +177,7 @@ jobs: path: wheelhouse/*.whl sdist: - name: "Build source distribution" + name: "Source distribution" runs-on: ubuntu-latest steps: - name: "Check out the repo" @@ -209,7 +209,7 @@ jobs: path: dist/*.tar.gz pypy: - name: "Build PyPy wheel" + name: "PyPy wheel" runs-on: ubuntu-latest steps: - name: "Check out the repo" From 402858f0e57a095e890ea34a0170caff321d4a04 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 16 Mar 2023 17:42:06 -0400 Subject: [PATCH 05/39] build: more convenient cheats --- .gitignore | 1 + Makefile | 4 ++++ howto.txt | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2373d5dc7..a49767e77 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ coverage.json # Stuff in the root. build *.egg-info +cheats.txt dist htmlcov MANIFEST diff --git a/Makefile b/Makefile index ce3772c82..bcca29ea7 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ clean: clean_platform ## Remove artifacts of test execution, installation, etc 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/ @@ -158,6 +159,9 @@ REPO_OWNER = nedbat/coveragepy edit_for_release: ## Edit sources to insert release facts. python igor.py edit_for_release +cheats: ## Create some useful snippets for releasing. + python igor.py cheats | tee cheats.txt + relbranch: ## Create the branch for releasing. echo git switch -c nedbat/release-$$(date +%Y%m%d) diff --git a/howto.txt b/howto.txt index 4125ec77e..24f01ecb6 100644 --- a/howto.txt +++ b/howto.txt @@ -3,16 +3,17 @@ - Check that the current virtualenv matches the current coverage branch. - start branch for release work $ make relbranch -- Version number in coverage/version.py +- Edit version number in coverage/version.py version_info = (4, 0, 2, "alpha", 1) version_info = (4, 0, 2, "beta", 1) version_info = (4, 0, 2, "candidate", 1) version_info = (4, 0, 2, "final", 0) - make sure: _dev = 0 -- Supported Python version numbers. Search for "PYVERSIONS". +- Edit supported Python version numbers. Search for "PYVERSIONS". - Update source files with release facts: $ make edit_for_release -- run `python igor.py cheats` to get useful snippets for next steps. +- Get useful snippets for next steps, and beyond, in cheats.txt + $ make cheats - Look over CHANGES.rst - Update README.rst - "New in x.y:" From 4024ef48612f3c2d20f320ee19b8724d19704bc0 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 20 Mar 2023 07:00:18 -0400 Subject: [PATCH 06/39] docs: more details, and current output, in contributing.rst --- doc/contributing.rst | 121 ++++++++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 43 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index e9d2c3a40..410d0d4cc 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -67,57 +67,91 @@ Running the tests The tests are written mostly as standard unittest-style tests, and are run with pytest running under `tox`_:: - $ tox - py37 create: /Users/nedbat/coverage/trunk/.tox/py37 - py37 installdeps: -rrequirements/pip.pip, -rrequirements/pytest.pip, eventlet==0.25.1, greenlet==0.4.15 - py37 develop-inst: /Users/nedbat/coverage/trunk - py37 installed: apipkg==1.5,appdirs==1.4.4,attrs==20.3.0,backports.functools-lru-cache==1.6.4,-e git+git@github.com:nedbat/coveragepy.git@36ef0e03c0439159c2245d38de70734fa08cddb4#egg=coverage,decorator==5.0.7,distlib==0.3.1,dnspython==2.1.0,eventlet==0.25.1,execnet==1.8.0,filelock==3.0.12,flaky==3.7.0,future==0.18.2,greenlet==0.4.15,hypothesis==6.10.1,importlib-metadata==4.0.1,iniconfig==1.1.1,monotonic==1.6,packaging==20.9,pluggy==0.13.1,py==1.10.0,PyContracts @ git+https://github.com/slorg1/contracts@c5a6da27d4dc9985f68e574d20d86000880919c3,pyparsing==2.4.7,pytest==6.2.3,pytest-forked==1.3.0,pytest-xdist==2.2.1,qualname==0.1.0,six==1.15.0,sortedcontainers==2.3.0,toml==0.10.2,typing-extensions==3.10.0.0,virtualenv==20.4.4,zipp==3.4.1 - py37 run-test-pre: PYTHONHASHSEED='376882681' - py37 run-test: commands[0] | python setup.py --quiet clean develop - py37 run-test: commands[1] | python igor.py zip_mods remove_extension - py37 run-test: commands[2] | python igor.py test_with_tracer py - === CPython 3.7.10 with Python tracer (.tox/py37/bin/python) === + % tox + 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) === bringing up nodes... - ........................................................................................................................................................... [ 15%] - ........................................................................................................................................................... [ 31%] - ...........................................................................................................................................s............... [ 47%] - ...........................................s...................................................................................sss.sssssssssssssssssss..... [ 63%] - ........................................................................................................................................................s.. [ 79%] - ......................................s..................................s................................................................................. [ 95%] - ........................................ss...... [100%] - 949 passed, 29 skipped in 40.56s - py37 run-test: commands[3] | python setup.py --quiet build_ext --inplace - py37 run-test: commands[4] | python igor.py test_with_tracer c - === CPython 3.7.10 with C tracer (.tox/py37/bin/python) === + .........................................................................................................................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) === bringing up nodes... - ........................................................................................................................................................... [ 15%] - ........................................................................................................................................................... [ 31%] - ......................................................................s.................................................................................... [ 47%] - ........................................................................................................................................................... [ 63%] - ..........................s................................................s............................................................................... [ 79%] - .................................................................................s......................................................................... [ 95%] - ......................................s......... [100%] - 973 passed, 5 skipped in 41.36s - ____________________________________________________________________________ summary _____________________________________________________________________________ - py37: commands succeeded - congratulations :) + ................................................................................................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) Tox runs the complete test suite twice for each version of Python you have -installed. The first run uses the Python implementation of the trace function, -the second uses the C implementation. +installed. The first run uses the C implementation of the trace function, +the second uses the Python implementation. To limit tox to just a few versions of Python, use the ``-e`` switch:: $ tox -e py37,py39 -To run just a few tests, you can use `pytest test selectors`_:: - - $ tox tests/test_misc.py - $ tox tests/test_misc.py::HasherTest - $ tox tests/test_misc.py::HasherTest::test_string_hashing - -These command run the tests in one file, one class, and just one test, -respectively. +On the tox command line, options after ``--`` are passed to pytest. To run +just a few tests, you can use `pytest test selectors`_:: + + $ tox -- tests/test_misc.py + $ tox -- tests/test_misc.py::HasherTest + $ tox -- tests/test_misc.py::HasherTest::test_string_hashing + +These commands run the tests in one file, one class, and just one test, +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:: + + $ tox -q -e py37 -- -n 0 -vv -k hash + === CPython 3.7.15 with C tracer (.tox/py37/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 + run-last-failure: no previously failed tests, not deselecting items. + + tests/test_data.py::CoverageDataTest::test_add_to_hash_with_lines PASSED [ 10%] + tests/test_data.py::CoverageDataTest::test_add_to_hash_with_arcs PASSED [ 20%] + tests/test_data.py::CoverageDataTest::test_add_to_lines_hash_with_missing_file PASSED [ 30%] + tests/test_data.py::CoverageDataTest::test_add_to_arcs_hash_with_missing_file PASSED [ 40%] + tests/test_execfile.py::RunPycFileTest::test_running_hashed_pyc PASSED [ 50%] + tests/test_misc.py::HasherTest::test_string_hashing PASSED [ 60%] + tests/test_misc.py::HasherTest::test_bytes_hashing PASSED [ 70%] + tests/test_misc.py::HasherTest::test_unicode_hashing PASSED [ 80%] + 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 ================================ + 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) You can also affect the test runs with environment variables. Define any of these as 1 to use them: @@ -156,7 +190,8 @@ some warnings. Please try to keep it that way, but don't let pylint warnings keep you from sending patches. I can clean them up. Lines should be kept to a 100-character maximum length. I recommend an -`editorconfig.org`_ plugin for your editor of choice. +`editorconfig.org`_ plugin for your editor of choice, which will also help with +indentation, line endings and so on. Other style questions are best answered by looking at the existing code. Formatting of docstrings, comments, long lines, and so on, should match the From 67b9e6c9b8422ddb20ebc6c637f058de5519df01 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Mon, 20 Mar 2023 10:08:32 -0700 Subject: [PATCH 07/39] build: Migrate pytest configuration to pyproject.toml. --- pyproject.toml | 26 ++++++++++++++++++++++++++ setup.cfg | 23 ----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e11a5af1d..6b02c6a47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,32 @@ exclude = """(?x)( | ^tests/balance_xdist_plugin\\.py$ # not part of our test suite. )""" +[tool.pytest.ini_options] +addopts = "-q -n auto -p no:legacypath --strict-markers --no-flaky-report -rfEX --failed-first" +python_classes = "*Test" +markers = [ + "expensive: too slow to run during \"make smoke\"", +] + +# How come these warnings are suppressed successfully here, but not in conftest.py?? +filterwarnings = [ + "ignore:the imp module is deprecated in favour of importlib:DeprecationWarning", + "ignore:distutils Version classes are deprecated:DeprecationWarning", + "ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning", +] + +# xfail tests that pass should fail the test suite +xfail_strict = true + +balanced_clumps = [ + # Because of expensive session-scoped fixture: + "VirtualenvTest", + # Because of shared-file manipulations (~/tests/actual/testing): + "CompareTest", + # No idea why this one fails if run on separate workers: + "GetZipBytesTest", +] + [tool.scriv] # Changelog management: https://pypi.org/project/scriv/ format = "rst" diff --git a/setup.cfg b/setup.cfg index adbdfb11a..db3fdce8e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,28 +1,5 @@ # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt -[tool:pytest] -addopts = -q -n auto -p no:legacypath --strict-markers --no-flaky-report -rfEX --failed-first -python_classes = *Test -markers = - expensive: too slow to run during "make smoke" - -# How come these warnings are suppressed successfully here, but not in conftest.py?? -filterwarnings = - ignore:the imp module is deprecated in favour of importlib:DeprecationWarning - ignore:distutils Version classes are deprecated:DeprecationWarning - ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning - -# xfail tests that pass should fail the test suite -xfail_strict = true - -balanced_clumps = - ; Because of expensive session-scoped fixture: - VirtualenvTest - ; Because of shared-file manipulations (~/tests/actual/testing): - CompareTest - ; No idea why this one fails if run on separate workers: - GetZipBytesTest - [metadata] license_files = LICENSE.txt From ea6db5e1aa9efd31b2569eb2f35597733358a388 Mon Sep 17 00:00:00 2001 From: Kassandra Keeton Date: Mon, 20 Mar 2023 17:01:18 -0500 Subject: [PATCH 08/39] docs: additional clarity for getting started + contributing (#1590) * additional clarity for getting started + contributing * Apply suggestions from code review Updating formatting (limitation of 79 characters for linting),. Co-authored-by: Ned Batchelder --------- Co-authored-by: Ned Batchelder --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 25239393e..8e3ffd940 100644 --- a/README.rst +++ b/README.rst @@ -70,7 +70,8 @@ For Enterprise Getting Started --------------- -See the `Quick Start section`_ of the docs. +Looking to run ``coverage`` on your test suite? See the `Quick Start section`_ +of the docs. .. _Quick Start section: https://coverage.readthedocs.io/#quick-start @@ -96,7 +97,8 @@ Community Code of Conduct`_. Contributing ------------ -See the `Contributing section`_ of the docs. +Found a bug? Want to help improve the code or documentation? See the +`Contributing section`_ of the docs. .. _Contributing section: https://coverage.readthedocs.io/en/latest/contributing.html From 14beae2e44155b4d833fed3c4e16084924db7fd5 Mon Sep 17 00:00:00 2001 From: polkapolka <7219835+polkapolka@users.noreply.github.com> Date: Mon, 20 Mar 2023 16:09:22 -0700 Subject: [PATCH 09/39] docs: update contribution instructions (#1591) * Updating contribution to include fork instructions * Fixing urls * Fix urls --- doc/contributing.rst | 45 ++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 410d0d4cc..c7b755364 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -33,17 +33,27 @@ you frustration. Getting the code ---------------- -The coverage.py code is hosted on a GitHub repository at -https://github.com/nedbat/coveragepy. To get a working environment, follow -these steps: +Fork the repo into your own github repository. If you have not forked a +repository before then please follow the `fork instructions`_ provided by +github. + +.. _fork instructions: https://docs.github.com/en/get-started/quickstart/fork-a-repo + +The coverage.py code will then be copied into a GitHub repository at +https://github.com/GITHUB_USER/coveragepy where GITHUB_USER is your github +username. To get a working development environment, follow these steps: .. minimum of PYVERSIONS: -#. Create a Python 3.7 virtualenv to work in, and activate it. +#. Create a virtualenv using one of the common virtualenv formats (conda, +venv, pipenv, etc) and a version of python greater than 3.7 to work in, and +activate it. Please follow your virtualenv format specific creation and +activation instructions. + #. Clone the repository:: - $ git clone https://github.com/nedbat/coveragepy + $ git clone https://github.com/GITHUB_USER/coveragepy $ cd coveragepy #. Install the requirements:: @@ -54,20 +64,23 @@ these steps: ``dev.in`` instead:: $ python3 -m pip install -r requirements/dev.in + + Note: You may need to upgrade pip to install the requirements. -#. Install a number of versions of Python. Coverage.py supports a range - of Python versions. The more you can test with, the more easily your code - can be used as-is. If you only have one version, that's OK too, but may - mean more work integrating your contribution. +#. (Optional) Install more versions of Python. By default, Coverage.py won't + run the tests on a version of python that isn't installed. Coverage.py + supports a range of Python versions. The more you can test with, the more + easily your code can be used as-is. If you only have one version, that's + OK too, but may mean more work integrating your contribution. Running the tests ----------------- The tests are written mostly as standard unittest-style tests, and are run with -pytest running under `tox`_:: +pytest running under `tox`_ by using the command `python3 -m tox`:: - % tox + % python3 -m tox 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 @@ -113,21 +126,21 @@ the second uses the Python implementation. To limit tox to just a few versions of Python, use the ``-e`` switch:: - $ tox -e py37,py39 + $ python3 -m tox -e py37,py39 On the tox command line, options after ``--`` are passed to pytest. To run just a few tests, you can use `pytest test selectors`_:: - $ tox -- tests/test_misc.py - $ tox -- tests/test_misc.py::HasherTest - $ tox -- tests/test_misc.py::HasherTest::test_string_hashing + $ python3 -m tox -- tests/test_misc.py + $ python3 -m tox -- tests/test_misc.py::HasherTest + $ python3 -m tox -- tests/test_misc.py::HasherTest::test_string_hashing These commands run the tests in one file, one class, and just one test, 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:: - $ tox -q -e py37 -- -n 0 -vv -k hash + $ python3 -m tox -q -e py37 -- -n 0 -vv -k hash === CPython 3.7.15 with C tracer (.tox/py37/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 From 1469085b50e887f3f0a592bfff55c525321619f9 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 20 Mar 2023 19:11:58 -0400 Subject: [PATCH 10/39] docs: further slimming down of contribution instructions --- doc/contributing.rst | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index c7b755364..7cba0859e 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -33,23 +33,19 @@ you frustration. Getting the code ---------------- -Fork the repo into your own github repository. If you have not forked a -repository before then please follow the `fork instructions`_ provided by -github. +The coverage.py code is hosted on a GitHub repository at +https://github.com/nedbat/coveragepy. To get a working environment, follow +these steps: -.. _fork instructions: https://docs.github.com/en/get-started/quickstart/fork-a-repo +#. `Fork the repo`__ into your own GitHub account. The coverage.py code +will then be copied into a GitHub repository at +https://github.com/GITHUB_USER/coveragepy where GITHUB_USER is your GitHub +username. -The coverage.py code will then be copied into a GitHub repository at -https://github.com/GITHUB_USER/coveragepy where GITHUB_USER is your github -username. To get a working development environment, follow these steps: - -.. minimum of PYVERSIONS: - -#. Create a virtualenv using one of the common virtualenv formats (conda, -venv, pipenv, etc) and a version of python greater than 3.7 to work in, and -activate it. Please follow your virtualenv format specific creation and -activation instructions. +__ https://docs.github.com/en/get-started/quickstart/fork-a-repo +#. (Optional) Create a virtualenv to work in, and activate it. There +are a number of ways to do this. Use the method you are comfortable with. #. Clone the repository:: @@ -58,27 +54,16 @@ activation instructions. #. Install the requirements:: - $ python3 -m pip install -r requirements/dev.pip - - If this fails due to incorrect or missing hashes, use - ``dev.in`` instead:: - $ python3 -m pip install -r requirements/dev.in - - Note: You may need to upgrade pip to install the requirements. -#. (Optional) Install more versions of Python. By default, Coverage.py won't - run the tests on a version of python that isn't installed. Coverage.py - supports a range of Python versions. The more you can test with, the more - easily your code can be used as-is. If you only have one version, that's - OK too, but may mean more work integrating your contribution. + Note: You may need to upgrade pip to install the requirements. Running the tests ----------------- The tests are written mostly as standard unittest-style tests, and are run with -pytest running under `tox`_ by using the command `python3 -m tox`:: +pytest running under `tox`_:: % python3 -m tox ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions From e73c858a603f23da9076a40f89c923ed86af9da2 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 20 Mar 2023 19:15:17 -0400 Subject: [PATCH 11/39] docs: correct name alphabetization --- CONTRIBUTORS.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index a50138f85..2c8a92e52 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -125,15 +125,15 @@ Michał Bultrowicz Michał Górny Mickie Betz Mike Fiedler -Naveen Yadav Nathan Land +Naveen Yadav Nikita Bloshchanevich Nils Kattenbeck Noel O'Boyle Olivier Grisel Ori Avtalion -Pankaj Pandey Pablo Carballo +Pankaj Pandey Patrick Mezard Peter Baughman Peter Ebden @@ -168,8 +168,8 @@ Thijs Triemstra Thomas Grainger Titus Brown Valentin Lab -Vince Salvino Ville Skyttä +Vince Salvino Xie Yanbo Yilei "Dolee" Yang Yury Selivanov From 5b39a88baf651628621510a60a3b8d6e4e183cab Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 20 Mar 2023 19:17:39 -0400 Subject: [PATCH 12/39] docs: three PRs from the PyCascades sprint --- CONTRIBUTORS.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 2c8a92e52..06a0605a5 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -99,6 +99,7 @@ Judson Neer Julian Berman Julien Voisin Justas Sadzevičius +Kassandra Keeton Kjell Braden Krystian Kichewko Kyle Altendorf @@ -127,6 +128,7 @@ Mickie Betz Mike Fiedler Nathan Land Naveen Yadav +Neil Pilgrim Nikita Bloshchanevich Nils Kattenbeck Noel O'Boyle @@ -138,6 +140,7 @@ Patrick Mezard Peter Baughman Peter Ebden Peter Portante +Phebe Polk Reya B Rodrigue Cloutier Roger Hu From 3ca4a7047a17a651e4eed9ca053735192634ece1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 06:51:51 -0400 Subject: [PATCH 13/39] build: make sure build can be deleted If the virtualenv tests fail, they somehow leave behind build directories with 000 permissions. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index bcca29ea7..565f0ab66 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ clean: clean_platform ## Remove artifacts of test execution, installation, etc @echo "Cleaning..." @-pip uninstall -yq coverage @rm -f *.pyd */*.pyd + @chmod -R 777 build @rm -rf build coverage.egg-info dist htmlcov @rm -f *.bak */*.bak */*/*.bak */*/*/*.bak */*/*/*/*.bak */*/*/*/*/*.bak @rm -f *$$py.class */*$$py.class */*/*$$py.class */*/*/*$$py.class */*/*/*/*$$py.class */*/*/*/*/*$$py.class From 220e6a724ed49fde399ab6c9ecbdf72367ba36a8 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 07:00:47 -0400 Subject: [PATCH 14/39] build: tidy up the clean action clean_platform was added in 7379c811580cd27e8695763ed5eb15746b133275 so we could remove platform-specific pyc files to run Linux tests. Those were removed in 76e80108c11b042e6e929641fe3f38975f5765ba, but it couldn't hurt to keep things organized this way. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 565f0ab66..1adda37b8 100644 --- a/Makefile +++ b/Makefile @@ -11,18 +11,18 @@ clean_platform: @rm -f *.so */*.so + @rm -f *.pyd */*.pyd @rm -rf __pycache__ */__pycache__ */*/__pycache__ */*/*/__pycache__ */*/*/*/__pycache__ */*/*/*/*/__pycache__ @rm -f *.pyc */*.pyc */*/*.pyc */*/*/*.pyc */*/*/*/*.pyc */*/*/*/*/*.pyc @rm -f *.pyo */*.pyo */*/*.pyo */*/*/*.pyo */*/*/*/*.pyo */*/*/*/*/*.pyo + @rm -f *$$py.class */*$$py.class */*/*$$py.class */*/*/*$$py.class */*/*/*/*$$py.class */*/*/*/*/*$$py.class clean: clean_platform ## Remove artifacts of test execution, installation, etc. @echo "Cleaning..." @-pip uninstall -yq coverage - @rm -f *.pyd */*.pyd @chmod -R 777 build @rm -rf build coverage.egg-info dist htmlcov @rm -f *.bak */*.bak */*/*.bak */*/*/*.bak */*/*/*/*.bak */*/*/*/*/*.bak - @rm -f *$$py.class */*$$py.class */*/*$$py.class */*/*/*$$py.class */*/*/*/*$$py.class */*/*/*/*/*$$py.class @rm -f coverage/*,cover @rm -f MANIFEST @rm -f .coverage .coverage.* coverage.xml coverage.json .metacov* From 019f0996ec3dcfd6c8237b336ac8d81256e58239 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 08:36:25 -0400 Subject: [PATCH 15/39] test: provide more guidance about working with gold files And make it easier to add new gold tests. --- tests/gold/README.rst | 18 ++++++++++++++---- tests/gold/html/Makefile | 2 +- tests/goldtest.py | 6 +++++- tests/test_goldtest.py | 6 +++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tests/gold/README.rst b/tests/gold/README.rst index aec1d6370..ec4081825 100644 --- a/tests/gold/README.rst +++ b/tests/gold/README.rst @@ -9,16 +9,26 @@ these comparisons is in tests/goldtest.py. If gold tests are failing, you may need to update the gold files by copying the current output of the tests into the gold files. When a test fails, the actual -output is in the tests/actual directory. Do not commit those files to git. +output is in the tests/actual directory. Those files are ignored by git. -You can run just the failed tests again with:: +There's a Makefile in the html directory for working with gold files and their +associated support files. If actual outputs have changed so that comparisons +are failing, but the new output is correct, you can use "make update-gold" to +copy the actual output as the new gold files. + +If you have added a gold test, you'll need to manually copy the tests/actual +files to tests/gold. + +Once you've copied the actual results to the gold files, or to check your work +again, you can run just the failed tests again with:: tox -e py39 -- -n 0 --lf The saved HTML files in the html directories can't be viewed properly without the supporting CSS and Javascript files. But we don't want to save copies of -those files in every subdirectory. There's a Makefile in the html directory -for working with the saved copies of the support files. +those files in every subdirectory. The make target "make complete" in +tests/gold/html will copy the support file so you can open the HTML files to +see how they look. If the output files are correct, you can update the gold files with "make update-gold". If there are version-specific gold files (for example, diff --git a/tests/gold/html/Makefile b/tests/gold/html/Makefile index 7be71f841..1b75f73d5 100644 --- a/tests/gold/html/Makefile +++ b/tests/gold/html/Makefile @@ -17,7 +17,7 @@ complete: ## Copy support files into directories so the HTML can be viewed prop clean: ## Remove the effects of this Makefile. @git clean -fq . -update-gold: ## Copy output files from latest tests to gold files. +update-gold: ## Copy actual output files from latest tests to gold files. @for sub in ../../actual/html/*; do \ rsync --verbose --existing --recursive $$sub/ $$(basename $$sub) ; \ done ; \ diff --git a/tests/goldtest.py b/tests/goldtest.py index 12a04af66..f7bd2e9b6 100644 --- a/tests/goldtest.py +++ b/tests/goldtest.py @@ -46,6 +46,8 @@ def compare( """ __tracebackhide__ = True # pytest, please don't show me this function. assert os_sep("/gold/") in expected_dir + assert os.path.exists(actual_dir) + os.makedirs(expected_dir, exist_ok=True) dc = filecmp.dircmp(expected_dir, actual_dir) diff_files = _fnmatch_list(dc.diff_files, file_pattern) @@ -56,9 +58,11 @@ def save_mismatch(f: str) -> None: """Save a mismatched result to tests/actual.""" save_path = expected_dir.replace(os_sep("/gold/"), os_sep("/actual/")) os.makedirs(save_path, exist_ok=True) - with open(os.path.join(save_path, f), "w") as savef: + save_file = os.path.join(save_path, f) + with open(save_file, "w") as savef: with open(os.path.join(actual_dir, f)) as readf: savef.write(readf.read()) + print(os_sep(f"Saved actual output to '{save_file}': see tests/gold/README.rst")) # filecmp only compares in binary mode, but we want text mode. So # look through the list of different files, and compare them diff --git a/tests/test_goldtest.py b/tests/test_goldtest.py index def5ee90e..297f21b0e 100644 --- a/tests/test_goldtest.py +++ b/tests/test_goldtest.py @@ -13,7 +13,7 @@ from tests.coveragetest import CoverageTest, TESTS_DIR from tests.goldtest import compare, gold_path from tests.goldtest import contains, contains_any, contains_rx, doesnt_contain -from tests.helpers import re_line, remove_tree +from tests.helpers import os_sep, re_line, remove_tree GOOD_GETTY = """\ Four score and seven years ago our fathers brought forth upon this continent, a @@ -73,6 +73,10 @@ def test_bad(self) -> None: assert "+ Five score" in stdout assert re_line(rf"^:::: diff '.*{GOLD_PATH_RX}' and '{OUT_PATH_RX}'", stdout) assert re_line(rf"^:::: end diff '.*{GOLD_PATH_RX}' and '{OUT_PATH_RX}'", stdout) + assert ( + os_sep(f"Saved actual output to '{ACTUAL_GETTY_FILE}': see tests/gold/README.rst") + in os_sep(stdout) + ) assert " D/D/D, Gxxx, Pennsylvania" in stdout # The actual file was saved. From eaa3c8adf13d3cfa0e83a6230b445a6ac54109de Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 08:51:02 -0400 Subject: [PATCH 16/39] test: check the HTML for context output --- tests/gold/html/contexts/index.html | 102 ++++++++++++++++++ tests/gold/html/contexts/two_tests_py.html | 119 +++++++++++++++++++++ tests/test_html.py | 3 + 3 files changed, 224 insertions(+) create mode 100644 tests/gold/html/contexts/index.html create mode 100644 tests/gold/html/contexts/two_tests_py.html diff --git a/tests/gold/html/contexts/index.html b/tests/gold/html/contexts/index.html new file mode 100644 index 000000000..05d6a457f --- /dev/null +++ b/tests/gold/html/contexts/index.html @@ -0,0 +1,102 @@ + + + + + Coverage report + + + + + +
+
+

Coverage report: + 94% +

+ +
+ +
+

+ coverage.py v7.2.3a0.dev1, + created at 2023-03-21 08:44 -0400 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Modulestatementsmissingexcludedcoverage
two_tests.py171094%
Total171094%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/tests/gold/html/contexts/two_tests_py.html b/tests/gold/html/contexts/two_tests_py.html new file mode 100644 index 000000000..5e107b5eb --- /dev/null +++ b/tests/gold/html/contexts/two_tests_py.html @@ -0,0 +1,119 @@ + + + + + Coverage for two_tests.py: 94% + + + + + +
+ +
+
+

1def helper(lineno): 

+

2 x = 2 (empty)two_tests.test_onetwo_tests.test_two

+

3 

+

4def test_one(): 

+

5 a = 5 two_tests.test_one

+

6 helper(6) two_tests.test_one

+

7 

+

8def test_two(): 

+

9 a = 9 two_tests.test_two

+

10 b = 10 two_tests.test_two

+

11 if a > 11: two_tests.test_two

+

12 b = 12 

+

13 assert a == (13-4) two_tests.test_two

+

14 assert b == (14-4) two_tests.test_two

+

15 helper( two_tests.test_two

+

16 16 

+

17 ) 

+

18 

+

19test_one() 

+

20x = 20 

+

21helper(21) 

+

22test_two() 

+
+ + + diff --git a/tests/test_html.py b/tests/test_html.py index 5113cd06e..89ad8d1c2 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1199,6 +1199,9 @@ def test_dynamic_contexts(self) -> None: ] assert sorted(expected) == sorted(actual) + cov.html_report(mod, directory="out/contexts") + compare_html(gold_path("html/contexts"), "out/contexts") + def test_filtered_dynamic_contexts(self) -> None: self.make_file("two_tests.py", self.SOURCE) cov = coverage.Coverage(source=["."]) From ef40735a819df29be7a2cdd39c4d2c2d480283fd Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 13:30:57 -0400 Subject: [PATCH 17/39] build(docs): only load sphinxcontrib.spelling if we are spell-checking #1593 --- doc/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 59907127a..92eb97997 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -36,7 +36,6 @@ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', - 'sphinxcontrib.spelling', 'sphinx.ext.intersphinx', 'sphinxcontrib.restbuilder', 'sphinx.ext.napoleon', @@ -220,6 +219,9 @@ # -- Spelling --- if any("spell" in arg for arg in sys.argv): + # sphinxcontrib.spelling needs the native "enchant" library, which often is + # missing, so only use the extension if we are specifically spell-checking. + extensions += ['sphinxcontrib.spelling'] names_file = tempfile.NamedTemporaryFile(mode='w', prefix="coverage_names_", suffix=".txt") with open("../CONTRIBUTORS.txt") as contributors: names = set(re.split(r"[^\w']", contributors.read())) From 72c61ed64e9bd960479eef81e8f22f31000e3440 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 13:35:24 -0400 Subject: [PATCH 18/39] build(docs): sort the spelling dict --- doc/dict.txt | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/dict.txt b/doc/dict.txt index 63544dcde..74f5a1e09 100644 --- a/doc/dict.txt +++ b/doc/dict.txt @@ -1,18 +1,35 @@ +API +BOM +BTW +CPython +CTracer +Cobertura +Consolas +Cython +DOCTYPE +DOM +HTML +Jinja +Mako +OK +PYTHONPATH +TODO +Tidelift +URL +UTF +XML activestate -api apache -API +api args argv ascii basename basenames bitbucket -BOM bom boolean booleans -BTW btw builtin builtins @@ -27,7 +44,6 @@ canonicalizes chdir'd clickable cmdline -Cobertura codecs colorsys combinable @@ -38,15 +54,11 @@ configurability configurability's configurer configurers -Consolas cov coveragepy coveragerc covhtml -CPython css -CTracer -Cython datetime deallocating dedent @@ -62,8 +74,6 @@ docstring docstrings doctest doctests -DOCTYPE -DOM encodable encodings endfor @@ -99,7 +109,6 @@ greenlet hotkey hotkeys html -HTML htmlcov http https @@ -111,15 +120,13 @@ ints invariants iterable iterables -Jinja -jquery jQuery +jquery json jython kwargs lcov localStorage -Mako manylinux matcher matchers @@ -151,7 +158,6 @@ num numbits numpy ok -OK opcode opcodes optparse @@ -165,8 +171,8 @@ pathnames plugin plugins pragma -pragmas pragma'd +pragmas pre prepended prepending @@ -181,7 +187,6 @@ pyproject pypy pytest pythonpath -PYTHONPATH pyw rcfile readme @@ -217,12 +222,10 @@ symlink symlinks syntaxes sys -templite templating +templite testability -Tidelift todo -TODO tokenization tokenize tokenized @@ -248,8 +251,6 @@ unrunnable unsubscriptable untokenizable username -URL -UTF utf vendored versionadded @@ -259,6 +260,5 @@ wildcard wildcards www xml -XML xrange xyzzy From 00d2ecf893fef59d17bfd434ef7e2d5e2fd50818 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 13:40:40 -0400 Subject: [PATCH 19/39] docs: correct some misspellings and add good words to the dict --- CONTRIBUTORS.txt | 1 + doc/dict.txt | 19 +++++++++++++++++++ doc/faq.rst | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 06a0605a5..0da824b8c 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -116,6 +116,7 @@ Marcus Cobden Marius Gedminas Mark van der Wal Martin Fuzzey +Mathieu Kniewallner Matt Bachmann Matthew Boehm Matthew Desmarais diff --git a/doc/dict.txt b/doc/dict.txt index 74f5a1e09..41d8c94f4 100644 --- a/doc/dict.txt +++ b/doc/dict.txt @@ -24,6 +24,7 @@ api args argv ascii +async basename basenames bitbucket @@ -59,8 +60,11 @@ coveragepy coveragerc covhtml css +dataio datetime deallocating +debounce +decodable dedent defaultdict deserialize @@ -85,6 +89,7 @@ exec'ing execfile executability executable's +execv expr extensibility favicon @@ -106,6 +111,7 @@ github gitignore globals greenlet +hintedness hotkey hotkeys html @@ -143,8 +149,10 @@ monospaced morf morfs multi +multiproc mumbo mycode +mypy namespace namespaces nano @@ -152,6 +160,8 @@ nbsp ned nedbat nedbatchelder +newb +nocover nosetests nullary num @@ -167,6 +177,7 @@ overridable parallelizing parsable parsers +pathlib pathnames plugin plugins @@ -174,6 +185,7 @@ pragma pragma'd pragmas pre +premain prepended prepending programmability @@ -181,7 +193,9 @@ programmatically py py's pyc +pyenv pyexpat +pylib pylint pyproject pypy @@ -191,6 +205,7 @@ pyw rcfile readme readthedocs +realpath recordable refactored refactoring @@ -199,9 +214,11 @@ regex regexes reimplemented renderer +rootname runnable runtime scrollbar +septatrix serializable settrace setuptools @@ -250,6 +267,7 @@ unparsable unrunnable unsubscriptable untokenizable +usecache username utf vendored @@ -259,6 +277,7 @@ wikipedia wildcard wildcards www +xdist xml xrange xyzzy diff --git a/doc/faq.rst b/doc/faq.rst index 8252eeb98..b25dce0fd 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -23,7 +23,7 @@ environment variable. This will write a line for each file considered, indicating whether it is traced or not, and if not, why not. Be careful though: the output might be swallowed by your test runner. If so, a ``COVERAGE_DEBUG_FILE=/tmp/cov.out`` -environemnt variable can direct the output to a file insttead to ensure you see +environment variable can direct the output to a file instead to ensure you see everything. From 551522eb214ad0c3f1dc48cd112a4f0ba6ddc6b6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 13:48:30 -0400 Subject: [PATCH 20/39] docs: fix some formatting in contributing.rst --- doc/contributing.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 7cba0859e..fa7bb9f0c 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -37,15 +37,13 @@ The coverage.py code is hosted on a GitHub repository at https://github.com/nedbat/coveragepy. To get a working environment, follow these steps: -#. `Fork the repo`__ into your own GitHub account. The coverage.py code -will then be copied into a GitHub repository at -https://github.com/GITHUB_USER/coveragepy where GITHUB_USER is your GitHub -username. - -__ https://docs.github.com/en/get-started/quickstart/fork-a-repo +#. `Fork the repo`_ into your own GitHub account. The coverage.py code will + then be copied into a GitHub repository at + ``https://github.com/GITHUB_USER/coveragepy`` where GITHUB_USER is your + GitHub username. #. (Optional) Create a virtualenv to work in, and activate it. There -are a number of ways to do this. Use the method you are comfortable with. + are a number of ways to do this. Use the method you are comfortable with. #. Clone the repository:: @@ -253,6 +251,7 @@ All contributions are expected to include tests for new functionality and fixes. If you need help writing tests, please ask. +.. _fork the repo: https://docs.github.com/en/get-started/quickstart/fork-a-repo .. _editorconfig.org: http://editorconfig.org .. _tox: https://tox.readthedocs.io/ .. _black: https://pypi.org/project/black/ From d6cb1cdca6d15f5ec02eb6708314589290321faf Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Wed, 22 Mar 2023 17:42:35 +0100 Subject: [PATCH 21/39] fix: put contexts dict in + {% endif %} + @@ -117,11 +124,9 @@

{% endif %} {# Things that should appear below the line. #} - {% if line.context_list %} + {% if line.context_str %} - {% for context in line.context_list %} - {{context}} - {% endfor %} + {{ line.context_str }} {% endif %}

diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index d6768a35e..ace48c2cf 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -258,7 +258,7 @@ kbd { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em @media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } } -#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; } +#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; text-align: right; } @media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } } diff --git a/coverage/htmlfiles/style.scss b/coverage/htmlfiles/style.scss index 1e9103fd1..fe3884871 100644 --- a/coverage/htmlfiles/style.scss +++ b/coverage/htmlfiles/style.scss @@ -622,6 +622,7 @@ $border-indicator-width: .2em; @include background-dark($dark-context-bg-color); border-radius: .25em; margin-right: 1.75em; + text-align: right; span { display: block; text-align: right; diff --git a/tests/gold/html/contexts/two_tests_py.html b/tests/gold/html/contexts/two_tests_py.html index 5e107b5eb..86239bd88 100644 --- a/tests/gold/html/contexts/two_tests_py.html +++ b/tests/gold/html/contexts/two_tests_py.html @@ -5,6 +5,13 @@ Coverage for two_tests.py: 94% + @@ -65,7 +72,7 @@

» next       coverage.py v7.2.3a0.dev1, - created at 2023-03-21 08:44 -0400 + created at 2023-03-22 16:13 +0100