Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nedbat/coveragepy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.5.0
Choose a base ref
...
head repository: nedbat/coveragepy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.0.2
Choose a head ref
Loading
Showing with 5,738 additions and 3,879 deletions.
  1. +3 −0 .editorconfig
  2. +44 −36 .github/workflows/coverage.yml
  3. +1 −1 .github/workflows/dependency-review.yml
  4. +9 −8 .github/workflows/kit.yml
  5. +8 −4 .github/workflows/python-nightly.yml
  6. +25 −3 .github/workflows/quality.yml
  7. +19 −19 .github/workflows/testsuite.yml
  8. +235 −17 CHANGES.rst
  9. +4 −0 CONTRIBUTORS.txt
  10. +1 −0 MANIFEST.in
  11. +10 −1 Makefile
  12. +1 −1 NOTICE.txt
  13. +15 −5 README.rst
  14. +22 −14 ci/github_releases.py
  15. +14 −4 coverage/annotate.py
  16. +4 −3 coverage/bytecode.py
  17. +64 −35 coverage/cmdline.py
  18. +83 −59 coverage/collector.py
  19. +110 −83 coverage/config.py
  20. +12 −7 coverage/context.py
  21. +305 −172 coverage/control.py
  22. +75 −38 coverage/data.py
  23. +72 −36 coverage/debug.py
  24. +20 −3 coverage/disposition.py
  25. +23 −18 coverage/env.py
  26. +0 −10 coverage/exceptions.py
  27. +1 −3 coverage/execfile.py
  28. +191 −74 coverage/files.py
  29. +54 −21 coverage/html.py
  30. +86 −95 coverage/inorout.py
  31. +18 −7 coverage/jsonreport.py
  32. +19 −4 coverage/lcovreport.py
  33. +16 −54 coverage/misc.py
  34. +11 −10 coverage/multiproc.py
  35. +13 −24 coverage/numbits.py
  36. +282 −238 coverage/parser.py
  37. +46 −68 coverage/phystokens.py
  38. +65 −33 coverage/plugin.py
  39. +62 −46 coverage/plugin_support.py
  40. +66 −56 coverage/python.py
  41. +34 −26 coverage/pytracer.py
  42. +33 −6 coverage/report.py
  43. +65 −43 coverage/results.py
  44. +245 −177 coverage/sqldata.py
  45. +170 −66 coverage/summary.py
  46. +1 −1 coverage/templite.py
  47. +89 −53 coverage/tomlconfig.py
  48. +35 −0 coverage/tracer.pyi
  49. +168 −0 coverage/types.py
  50. +28 −10 coverage/version.py
  51. +49 −27 coverage/xmlreport.py
  52. +13 −13 doc/changes.rst
  53. +46 −23 doc/cmd.rst
  54. +19 −8 doc/conf.py
  55. +34 −18 doc/config.rst
  56. +2 −2 doc/dbschema.rst
  57. +0 −3 doc/dict.txt
  58. +15 −2 doc/faq.rst
  59. +3 −4 doc/index.rst
  60. +4 −1 doc/python-coverage.1.txt
  61. +41 −46 doc/requirements.pip
  62. +4 −4 doc/sample_html/d_7b071bdc2a35fa80___init___py.html
  63. +4 −4 doc/sample_html/d_7b071bdc2a35fa80___main___py.html
  64. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_backward_py.html
  65. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_cogapp_py.html
  66. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_makefiles_py.html
  67. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_test_cogapp_py.html
  68. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_test_makefiles_py.html
  69. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_test_whiteutils_py.html
  70. +4 −4 doc/sample_html/d_7b071bdc2a35fa80_whiteutils_py.html
  71. +4 −4 doc/sample_html/index.html
  72. +1 −1 doc/sample_html/status.json
  73. +25 −6 doc/source.rst
  74. +15 −17 howto.txt
  75. +105 −52 igor.py
  76. +10 −15 metacov.ini
  77. +1 −0 pylintrc
  78. +20 −1 pyproject.toml
  79. +2 −2 requirements/dev.in
  80. +222 −266 requirements/dev.pip
  81. +44 −51 requirements/kit.pip
  82. +166 −155 requirements/light-threads.pip
  83. +237 −283 requirements/lint.pip
  84. +6 −0 requirements/mypy.in
  85. +76 −0 requirements/mypy.pip
  86. +2 −7 requirements/pins.pip
  87. +31 −39 requirements/pip-tools.pip
  88. +27 −29 requirements/pip.pip
  89. +0 −10 requirements/pytest.in
  90. +35 −74 requirements/pytest.pip
  91. +38 −40 requirements/tox.pip
  92. +0 −9 setup.cfg
  93. +13 −6 setup.py
  94. +1 −1 tests/balance_xdist_plugin.py
  95. +0 −9 tests/conftest.py
  96. +10 −20 tests/coveragetest.py
  97. +24 −20 tests/goldtest.py
  98. +68 −40 tests/helpers.py
  99. +6 −4 tests/mixins.py
  100. +349 −146 tests/test_api.py
  101. +33 −32 tests/test_arcs.py
  102. +117 −76 tests/test_cmdline.py
  103. +7 −11 tests/test_concurrency.py
  104. +62 −29 tests/test_config.py
  105. +3 −3 tests/test_context.py
  106. +0 −4 tests/test_coverage.py
  107. +24 −2 tests/test_data.py
  108. +1 −5 tests/test_execfile.py
  109. +319 −115 tests/test_files.py
  110. +126 −79 tests/test_html.py
  111. +13 −6 tests/test_lcov.py
  112. +2 −53 tests/test_misc.py
  113. +4 −13 tests/test_oddball.py
  114. +6 −6 tests/test_parser.py
  115. +2 −115 tests/test_phystokens.py
  116. +6 −14 tests/test_plugins.py
  117. +8 −19 tests/test_process.py
  118. +0 −4 tests/test_python.py
  119. +138 −47 tests/test_summary.py
  120. +1 −8 tests/test_venv.py
  121. +11 −6 tests/test_version.py
  122. +49 −42 tests/test_xml.py
  123. +29 −8 tox.ini
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ trim_trailing_whitespace = true
[*.py]
max_line_length = 100

[*.pyi]
max_line_length = 100

[*.c]
max_line_length = 100

80 changes: 44 additions & 36 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ defaults:

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
FORCE_COLOR: 1 # Get colored pytest output

permissions:
contents: read
@@ -46,15 +47,25 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11.0-rc.2"
- "3.11"
- "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
python-version: "pypy-3.9"
# If one job fails, stop the whole thing.
fail-fast: true

@@ -94,6 +105,10 @@ jobs:
name: "Combine coverage data"
needs: coverage
runs-on: ubuntu-latest
outputs:
total: ${{ steps.total.outputs.total }}
env:
COVERAGE_RCFILE: "metacov.ini"

steps:
- name: "Check out the repo"
@@ -102,7 +117,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.7" # Minimum of PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'

@@ -122,71 +137,69 @@ jobs:
- name: "Combine and report"
id: combine
env:
COVERAGE_RCFILE: "metacov.ini"
COVERAGE_METAFILE: ".metacov"
COVERAGE_CONTEXT: "yes"
run: |
set -xe
python -m igor combine_html
python -m coverage json
python igor.py combine_html
- name: "Upload HTML report"
uses: actions/upload-artifact@v3
with:
name: html_report
path: htmlcov

- name: "Upload JSON report"
uses: actions/upload-artifact@v3
with:
name: json_report
path: coverage.json
- name: "Get total"
id: total
run: |
echo "total=$(python -m coverage report --format=total)" >> $GITHUB_OUTPUT
publish:
name: "Publish coverage report"
needs: combine
runs-on: ubuntu-latest

steps:
- name: "Checkout reports repo"
run: |
set -xe
git clone --depth=1 --no-checkout https://${{ secrets.COVERAGE_REPORTS_TOKEN }}@github.com/nedbat/coverage-reports reports_repo
cd reports_repo
git sparse-checkout init --cone
git sparse-checkout set --skip-checks '/*' '!/reports'
git config user.name nedbat
git config user.email ned@nedbatchelder.com
git checkout main
- name: "Download coverage JSON report"
uses: actions/download-artifact@v3
with:
name: json_report

- name: "Compute info for later steps"
id: info
run: |
set -xe
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
export SHA10=$(echo ${{ github.sha }} | cut -c 1-10)
export SLUG=$(date +'%Y%m%d')_$SHA10
export REPORT_DIR=reports/$SLUG/htmlcov
export REF="${{ github.ref }}"
echo "total=$TOTAL" >> $GITHUB_ENV
echo "total=${{ needs.combine.outputs.total }}" >> $GITHUB_ENV
echo "sha10=$SHA10" >> $GITHUB_ENV
echo "slug=$SLUG" >> $GITHUB_ENV
echo "report_dir=$REPORT_DIR" >> $GITHUB_ENV
echo "url=https://nedbat.github.io/coverage-reports/$REPORT_DIR" >> $GITHUB_ENV
echo "branch=${REF#refs/heads/}" >> $GITHUB_ENV
- name: "Create summary"
run: |
echo '### Total coverage: ${{ env.total }}%' >> $GITHUB_STEP_SUMMARY
echo '[${{ env.url }}](${{ env.url }})' >> $GITHUB_STEP_SUMMARY
- name: "Checkout reports repo"
if: ${{ github.ref == 'refs/heads/master' }}
run: |
set -xe
git clone --depth=1 --no-checkout https://${{ secrets.COVERAGE_REPORTS_TOKEN }}@github.com/nedbat/coverage-reports reports_repo
cd reports_repo
git sparse-checkout init --cone
git sparse-checkout set --skip-checks '/*' '!/reports'
git config user.name nedbat
git config user.email ned@nedbatchelder.com
git checkout main
- name: "Download coverage HTML report"
if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/download-artifact@v3
with:
name: html_report
path: reports_repo/${{ env.report_dir }}

- name: "Push to report repo"
if: ${{ github.ref == 'refs/heads/master' }}
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
@@ -209,9 +222,9 @@ jobs:
git push
- name: "Create badge"
if: ${{ github.ref == 'refs/heads/master' }}
# https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5
# uses: schneegans/dynamic-badges-action@v1.4.0
uses: schneegans/dynamic-badges-action@54d929a33e7521ab6bf19d323d28fb7b876c53f7
uses: schneegans/dynamic-badges-action@5d424ad4060f866e4d1dab8f8da0456e6b1c4f56
with:
auth: ${{ secrets.METACOV_GIST_SECRET }}
gistID: 8c6980f77988a327348f9b02bbaf67f5
@@ -221,8 +234,3 @@ jobs:
minColorRange: 60
maxColorRange: 95
valColorRange: ${{ env.total }}

- name: "Create summary"
run: |
echo '### Total coverage: ${{ env.total }}%' >> $GITHUB_STEP_SUMMARY
echo '[${{ env.url }}](${{ env.url }})' >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -17,4 +17,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v3
17 changes: 9 additions & 8 deletions .github/workflows/kit.yml
Original file line number Diff line number Diff line change
@@ -77,11 +77,13 @@ jobs:
# }
# # PYVERSIONS. Available versions:
# # https://github.com/actions/python-versions/blob/main/versions-manifest.json
# # Include prereleases if they are at rc stage.
# # PyPy versions are handled further below in the "pypy" step.
# pys = ["cp37", "cp38", "cp39", "cp310", "cp311"]
#
# # Some OS/arch combinations need overrides for the Python versions:
# os_arch_pys = {
# ("macos", "arm64"): ["cp38", "cp39", "cp310"],
# ("macos", "arm64"): ["cp38", "cp39", "cp310", "cp311"],
# }
#
# #----- ^^^ ---------------------- ^^^ -----
@@ -115,6 +117,7 @@ jobs:
- {"os": "macos", "py": "cp38", "arch": "arm64"}
- {"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"}
@@ -130,14 +133,13 @@ jobs:
- {"os": "windows", "py": "cp39", "arch": "AMD64"}
- {"os": "windows", "py": "cp310", "arch": "AMD64"}
- {"os": "windows", "py": "cp311", "arch": "AMD64"}
# [[[end]]] (checksum: 428e5138336453464dde968cc3149f4f)
# [[[end]]] (checksum: ded8a9f214bf59776562d91ae6828863)
fail-fast: false

steps:
- name: "Setup QEMU"
if: matrix.os == 'ubuntu'
# uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
with:
platforms: arm64

@@ -216,8 +218,7 @@ jobs:
- name: "Install PyPy"
uses: actions/setup-python@v4
with:
# PYVERSIONS
python-version: "pypy-3.7"
python-version: "pypy-3.7" # Minimum of PyPy PYVERSIONS
cache: pip
cache-dependency-path: 'requirements/*.pip'

@@ -227,9 +228,9 @@ jobs:
- name: "Build wheel"
run: |
# One wheel works for all PyPy versions.
# 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=pp36.pp37.pp38"
pypy3 -m build -w -C="--global-option=--python-tag" -C="--global-option=pp37.pp38.pp39"
- name: "List wheels"
run: |
12 changes: 8 additions & 4 deletions .github/workflows/python-nightly.yml
Original file line number Diff line number Diff line change
@@ -32,7 +32,12 @@ concurrency:
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
# Choose a recent Ubuntu that deadsnakes still builds all the versions for.
# For example, deadsnakes doesn't provide 3.10 nightly for 22.04 (jammy)
# 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
runs-on: ubuntu-20.04

strategy:
matrix:
@@ -41,9 +46,9 @@ jobs:
# tox.ini so that tox will run properly. PYVERSIONS
# Available versions:
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages
- "3.9-dev"
- "3.10-dev"
- "3.11-dev"
- "3.12-dev"
# https://github.com/actions/setup-python#available-versions-of-pypy
- "pypy-3.7-nightly"
- "pypy-3.8-nightly"
@@ -55,8 +60,7 @@ jobs:
uses: "actions/checkout@v3"

- name: "Install ${{ matrix.python-version }} with deadsnakes"
# uses: deadsnakes/action@v2.1.1
uses: deadsnakes/action@7ab8819e223c70d2bdedd692dfcea75824e0a617
uses: deadsnakes/action@e3117c2981fd8afe4af79f3e1be80066c82b70f5
if: "!startsWith(matrix.python-version, 'pypy-')"
with:
python-version: "${{ matrix.python-version }}"
28 changes: 25 additions & 3 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -46,15 +46,37 @@ jobs:

- name: "Install dependencies"
run: |
set -xe
python -VV
python -m site
python -m pip install --require-hashes -r requirements/tox.pip
- name: "Tox lint"
run: |
python -m tox -e lint
mypy:
name: "Check types"
runs-on: ubuntu-latest

steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.8" # Minimum of PYVERSIONS, but at least 3.8
cache: pip
cache-dependency-path: 'requirements/*.pip'

- name: "Install dependencies"
run: |
# We run on 3.8, but the pins were made on 3.7, so don't insist on
# hashes, which won't match.
python -m pip install -r requirements/tox.pip
- name: "Tox mypy"
run: |
python -m tox -e mypy
doc:
name: "Build docs"
runs-on: ubuntu-latest
38 changes: 19 additions & 19 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ defaults:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
COVERAGE_IGOR_VERBOSE: 1
FORCE_COLOR: 1 # Get colored pytest output

permissions:
contents: read
@@ -47,9 +48,13 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11.0-rc.2"
- "3.11"
- "pypy-3.7"
- "pypy-3.9"
exclude:
# Windows PyPy-3.9 always gets killed.
- os: windows
python-version: "pypy-3.9"
fail-fast: false

steps:
@@ -73,31 +78,26 @@ jobs:
# python -c "import urllib.request as r; exec(r.urlopen('https://bit.ly/pydoctor').read())"
- name: "Run tox for ${{ matrix.python-version }}"
continue-on-error: true
id: tox1
run: |
python -m tox -- -rfsEX
- name: "Retry tox for ${{ matrix.python-version }}"
id: tox2
if: steps.tox1.outcome == 'failure'
if: failure()
run: |
python -m tox -- -rfsEX
- name: "Set status"
if: always()
run: |
if ${{ steps.tox1.outcome != 'success' && steps.tox2.outcome != 'success' }}; then
exit 1
fi
# `exit 1` makes sure that the job remains red with flaky runs
python -m tox -- -rfsEX --lf -vvvvv && exit 1
# A final step to give a simple name for required status checks.
# This job aggregates test results. It's the required check for branch protection.
# https://github.com/marketplace/actions/alls-green#why
# https://github.com/orgs/community/discussions/33579
success:
needs: tests
runs-on: ubuntu-latest
name: Tests successful
if: always()
needs:
- tests
runs-on: ubuntu-latest
steps:
- name: "Success"
run: |
echo Tests successful
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
jobs: ${{ toJSON(needs) }}
Loading