From 08ced5774967f32c5c61084ddfcc5df81e253f55 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Tue, 12 Jul 2022 11:51:25 -0400
Subject: [PATCH 001/525] build: bump version
---
CHANGES.rst | 6 ++++++
coverage/version.py | 2 +-
howto.txt | 1 -
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index fdedc7aaa..22bf66730 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.
+
+
.. _changes_6-4-2:
Version 6.4.2 — 2022-07-12
diff --git a/coverage/version.py b/coverage/version.py
index 33fce3c28..cb4b80a26 100644
--- a/coverage/version.py
+++ b/coverage/version.py
@@ -5,7 +5,7 @@
# This file is exec'ed in setup.py, don't import anything!
# Same semantics as sys.version_info.
-version_info = (6, 4, 2, "final", 0)
+version_info = (6, 4, 3, "alpha", 0)
def _make_version(major, minor, micro, releaselevel, serial):
diff --git a/howto.txt b/howto.txt
index 47da48baa..01440638e 100644
--- a/howto.txt
+++ b/howto.txt
@@ -86,7 +86,6 @@
- things to automate:
- url to link to latest changes in docs
- next version.py line
- - curl to start the kit actions going
- readthedocs api to do the readthedocs changes
From 09be476a63c5aa2c39bdaff4db9b244da2a39a4a Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 13 Jul 2022 08:41:30 -0400
Subject: [PATCH 002/525] build: use 3.11.0b4 in ci
---
.github/workflows/coverage.yml | 2 +-
.github/workflows/testsuite.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 00d81159a..20c0bcc32 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -39,7 +39,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- - "3.11.0-beta.3"
+ - "3.11.0-beta.4"
- "pypy-3.7"
exclude:
# Windows PyPy doesn't seem to work?
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index 23c30e3c9..68535deb3 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -42,7 +42,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- - "3.11.0-beta.3"
+ - "3.11.0-beta.4"
- "pypy-3.7"
exclude:
# Windows PyPy doesn't seem to work?
From 6dff85d81bb77d6212b9fb6a9937729d5012c065 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sun, 17 Jul 2022 06:36:10 -0400
Subject: [PATCH 003/525] build: avoid a script injection attack
Details here: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
Found with https://rhysd.github.io/actionlint/
---
.github/workflows/coverage.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 20c0bcc32..622a4c2a2 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -185,6 +185,8 @@ jobs:
path: reports_repo/${{ env.report_dir }}
- name: "Push to report repo"
+ env:
+ COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
set -xe
# Make the redirect to the latest report.
@@ -192,7 +194,7 @@ jobs:
echo "" >> reports_repo/latest.html
echo "Coverage report redirect..." >> reports_repo/latest.html
# Make the commit message.
- echo "${{ env.total }}% - ${{ github.event.head_commit.message }}" > commit.txt
+ echo "${{ env.total }}% - $COMMIT_MESSAGE" > commit.txt
echo "" >> commit.txt
echo "${{ env.url }}" >> commit.txt
echo "${{ env.sha10 }}: ${{ env.branch }}" >> commit.txt
From b8cb29e53ee6d3a2fda8a342de72e3fefec7d547 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Thu, 28 Jul 2022 16:51:46 -0400
Subject: [PATCH 004/525] build: use 3.11.0b5 in ci
---
.github/workflows/coverage.yml | 2 +-
.github/workflows/testsuite.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 622a4c2a2..eb21145d2 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -39,7 +39,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- - "3.11.0-beta.4"
+ - "3.11.0-beta.5"
- "pypy-3.7"
exclude:
# Windows PyPy doesn't seem to work?
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index 68535deb3..f3db96162 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -42,7 +42,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- - "3.11.0-beta.4"
+ - "3.11.0-beta.5"
- "pypy-3.7"
exclude:
# Windows PyPy doesn't seem to work?
From 30a249aac87be4701bfafae2ed3c5a6e964aa3fc Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 30 Jul 2022 10:07:06 -0400
Subject: [PATCH 005/525] test: xfail some tests that need PyPy to improve
#1426
https://foss.heptapod.net/pypy/pypy/-/issues/3792
---
coverage/env.py | 2 +-
tests/helpers.py | 7 ++++++-
tests/test_process.py | 6 ++++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/coverage/env.py b/coverage/env.py
index 2e21b9a7d..13411699a 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -85,7 +85,7 @@ class PYBEHAVIOR:
nix_while_true = (PYVERSION >= (3, 8))
# CPython 3.9a1 made sys.argv[0] and other reported files absolute paths.
- report_absolute_files = (CPYTHON and PYVERSION >= (3, 9))
+ report_absolute_files = ((CPYTHON or (PYPYVERSION >= (7, 3, 10))) and PYVERSION >= (3, 9))
# Lines after break/continue/return/raise are no longer compiled into the
# bytecode. They used to be marked as missing, now they aren't executable.
diff --git a/tests/helpers.py b/tests/helpers.py
index 32115dc1d..f593c72c6 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -320,5 +320,10 @@ def swallow_warnings(message=r".", category=CoverageWarning):
xfail_pypy_3749 = pytest.mark.xfail(
env.PYVERSION[:2] == (3, 8) and env.PYPY and env.PYPYVERSION >= (7, 3, 10),
- reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749"
+ reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3749",
+)
+
+xfail_pypy_3792 = pytest.mark.xfail(
+ env.PYBEHAVIOR.report_absolute_files and env.PYPY,
+ reason="Avoid a PyPy bug: https://foss.heptapod.net/pypy/pypy/-/issues/3792",
)
diff --git a/tests/test_process.py b/tests/test_process.py
index c473cf9a7..fcbcb9ba7 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -19,7 +19,7 @@
from coverage.files import abs_file, python_reported_file
from tests.coveragetest import CoverageTest, TESTS_DIR
-from tests.helpers import re_lines_text
+from tests.helpers import re_lines_text, xfail_pypy_3792
class ProcessTest(CoverageTest):
@@ -283,6 +283,7 @@ def test_running_missing_file(self):
assert "rror" not in out
assert status == 1
+ @xfail_pypy_3792 # Because the file names aren't yet absolute.
def test_code_throws(self):
self.make_file("throw.py", """\
class MyException(Exception):
@@ -302,7 +303,7 @@ def f2():
status, out = self.run_command_status("coverage run throw.py")
out2 = self.run_command("python throw.py")
if env.PYPY:
- # Pypy has an extra frame in the traceback for some reason
+ # PyPy has an extra frame in the traceback for some reason
out2 = re_lines_text("toplevel", out2, match=False)
assert out == out2
@@ -695,6 +696,7 @@ def test_coverage_run_dashm_is_like_python_dashm(self):
actual = self.run_command("coverage run -m process_test.try_execfile")
self.assert_tryexecfile_output(expected, actual)
+ @xfail_pypy_3792 # Because the sys.path[0] isn't yet absolute.
def test_coverage_run_dir_is_like_python_dir(self):
with open(TRY_EXECFILE) as f:
self.make_file("with_main/__main__.py", f.read())
From aa340803944d406622bbfce16107d25a9d55b2cf Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 3 Aug 2022 11:41:35 -0400
Subject: [PATCH 006/525] docs: a GitHub security policy
---
.github/SECURITY.md | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 .github/SECURITY.md
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 000000000..005467cec
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,4 @@
+# Security Disclosures
+
+To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
+Tidelift will coordinate the fix and disclosure with maintainers.
From 08b9db03d303f208fd276a86c231c94b2ea7d5b1 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 3 Aug 2022 11:55:49 -0400
Subject: [PATCH 007/525] build: be explicit about actions only having
permission to read contents
---
.github/workflows/coverage.yml | 3 +++
.github/workflows/python-nightly.yml | 3 +++
2 files changed, 6 insertions(+)
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index eb21145d2..ac1ee43d4 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -19,6 +19,9 @@ defaults:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
+permissions:
+ contents: read
+
jobs:
coverage:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index 6aec3b8b9..ea71bb27b 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -22,6 +22,9 @@ env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
COVERAGE_IGOR_VERBOSE: 1
+permissions:
+ contents: read
+
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
From 673fbf1d7edaea895b26a506b0a5e58e286bf0e8 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Wed, 3 Aug 2022 12:17:35 -0400
Subject: [PATCH 008/525] build: use built-in workflow cancelling
---
.github/workflows/cancel.yml | 25 -------------------------
.github/workflows/coverage.yml | 4 ++++
.github/workflows/kit.yml | 4 ++++
.github/workflows/python-nightly.yml | 4 ++++
.github/workflows/quality.yml | 4 ++++
.github/workflows/testsuite.yml | 4 ++++
6 files changed, 20 insertions(+), 25 deletions(-)
delete mode 100644 .github/workflows/cancel.yml
diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml
deleted file mode 100644
index f25aaec0b..000000000
--- a/.github/workflows/cancel.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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 action finds in-progress Action jobs for the same branch, and cancels
-# them. There's little point in continuing to run superseded jobs.
-
-name: "Cancel"
-
-on:
- push:
-
-permissions:
- contents: read
-
-jobs:
- cancel:
- permissions:
- actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
- runs-on: ubuntu-latest
- steps:
- - name: "Cancel Previous Runs"
- uses: styfle/cancel-workflow-action@0.10.0
- with:
- access_token: ${{ github.token }}
- workflow_id: all
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index ac1ee43d4..88af417b2 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -22,6 +22,10 @@ env:
permissions:
contents: read
+concurrency:
+ group: "${{ github.workflow }}-${{ github.ref }}"
+ cancel-in-progress: true
+
jobs:
coverage:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index fcce04c66..f8f0c9f87 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -41,6 +41,10 @@ env:
permissions:
contents: read
+concurrency:
+ group: "${{ github.workflow }}-${{ github.ref }}"
+ cancel-in-progress: true
+
jobs:
wheels:
name: "Build ${{ matrix.os }} ${{ matrix.py }} ${{ matrix.arch }} wheels"
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index ea71bb27b..44e758868 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -25,6 +25,10 @@ env:
permissions:
contents: read
+concurrency:
+ group: "${{ github.workflow }}-${{ github.ref }}"
+ cancel-in-progress: true
+
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
index 678e8310e..2394b7797 100644
--- a/.github/workflows/quality.yml
+++ b/.github/workflows/quality.yml
@@ -21,6 +21,10 @@ env:
permissions:
contents: read
+concurrency:
+ group: "${{ github.workflow }}-${{ github.ref }}"
+ cancel-in-progress: true
+
jobs:
lint:
name: "Pylint etc"
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index f3db96162..e70032e5c 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -22,6 +22,10 @@ env:
permissions:
contents: read
+concurrency:
+ group: "${{ github.workflow }}-${{ github.ref }}"
+ cancel-in-progress: true
+
jobs:
tests:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
From 6ffb2c331d19d42580bfdaf0c44f5441b9ceb419 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Fri, 5 Aug 2022 10:01:10 -0400
Subject: [PATCH 009/525] build: last action to set permissions on
---
.github/workflows/codeql-analysis.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index b1d24b6f3..ad316eb4d 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -22,6 +22,9 @@ on:
schedule:
- cron: '30 20 * * 6'
+permissions:
+ contents: read
+
jobs:
analyze:
name: Analyze
From f54428fb8dfe98aacecc0b66e3c1ca2071ce1834 Mon Sep 17 00:00:00 2001
From: Matus Valo
Date: Fri, 25 Mar 2022 21:00:02 +0100
Subject: [PATCH 010/525] Map also empty dictionaries to file
---
coverage/collector.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coverage/collector.py b/coverage/collector.py
index 94d9cb5c5..f546559bc 100644
--- a/coverage/collector.py
+++ b/coverage/collector.py
@@ -432,7 +432,7 @@ def mapped_file_dict(self, d):
else:
raise runtime_err # pragma: cant happen
- return {self.cached_mapped_file(k): v for k, v in items if v}
+ return {self.cached_mapped_file(k): v for k, v in items}
def plugin_was_disabled(self, plugin):
"""Record that `plugin` was disabled during the run."""
From c31e9ad4fb1e9c2be5d60e10038514b443817afb Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 13:37:45 -0400
Subject: [PATCH 011/525] fix: cython readonly members caused problems? #972
---
CHANGES.rst | 6 +++++-
CONTRIBUTORS.txt | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 22bf66730..ae7704882 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,7 +20,11 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
-Nothing yet.
+- Fix a problem with Cython code measurement (`pull 1347`_, fixing `issue
+ 972`_). Thanks, Matus Valo.
+
+.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
.. _changes_6-4-2:
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 2e4ed85b3..2dde5f4a4 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -107,6 +107,7 @@ Martin Fuzzey
Matt Bachmann
Matthew Boehm
Matthew Desmarais
+Matus Valo
Max Linke
Michał Bultrowicz
Mickie Betz
From 1060813b718e60ad52508bf9df33d18e493cea56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenzo=20Mic=C3=B2?=
<41483803+lormico@users.noreply.github.com>
Date: Sat, 6 Aug 2022 20:00:15 +0200
Subject: [PATCH 012/525] fix: don't fail if can't find a relative path to a
data file on another volume on win32 (#1428) (#1430)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Lorenzo Micò
---
coverage/data.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/coverage/data.py b/coverage/data.py
index f605e1644..bcbfa427c 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -132,7 +132,13 @@ def combine_parallel_data(
data.update(new_data, aliases=aliases)
files_combined += 1
if message:
- message(f"Combined data file {os.path.relpath(f)}")
+ try:
+ message(f"Combined data file {os.path.relpath(f)}")
+ except ValueError:
+ # ValueError can be raised under Windows when os.getcwd() returns a
+ # folder from a different drive than the drive of f, in which case
+ # we print the original value of f instead of its relative path
+ message(f"Combined data file {f!r}")
if not keep:
if data._debug.should('dataio'):
data._debug.write(f"Deleting combined data file {f!r}")
From ef978c16ee7afaf5d30958c6214de2c755b4edbf Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 14:07:11 -0400
Subject: [PATCH 013/525] fix: reduce the scope of a try/except.
---
CHANGES.rst | 8 +++++++-
CONTRIBUTORS.txt | 1 +
coverage/data.py | 5 +++--
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index ae7704882..1a50184ac 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,11 +20,17 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Fix a messaging failure when combining Windows data files on a different
+ drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
+ Thanks, Lorenzo Micò.
+
- Fix a problem with Cython code measurement (`pull 1347`_, fixing `issue
972`_). Thanks, Matus Valo.
-.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
+.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
+.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
.. _changes_6-4-2:
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 2dde5f4a4..76b5f5700 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -98,6 +98,7 @@ Lars Hupfeldt Nielsen
Leonardo Pistone
Lex Berezhny
Loïc Dachary
+Lorenzo Micò
Marc Abramowitz
Marcelo Trylesinski
Marcus Cobden
diff --git a/coverage/data.py b/coverage/data.py
index bcbfa427c..b209cf157 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -133,12 +133,13 @@ def combine_parallel_data(
files_combined += 1
if message:
try:
- message(f"Combined data file {os.path.relpath(f)}")
+ file_name = os.path.relpath(f)
except ValueError:
# ValueError can be raised under Windows when os.getcwd() returns a
# folder from a different drive than the drive of f, in which case
# we print the original value of f instead of its relative path
- message(f"Combined data file {f!r}")
+ file_name = f
+ message(f"Combined data file {file_name}")
if not keep:
if data._debug.should('dataio'):
data._debug.write(f"Deleting combined data file {f!r}")
From 568916db93a04c37087df856756623c3510673d7 Mon Sep 17 00:00:00 2001
From: LordBaryhobal <47377497+LordBaryhobal@users.noreply.github.com>
Date: Sat, 6 Aug 2022 20:11:42 +0200
Subject: [PATCH 014/525] fixed "mNan" id in scroll markers (#1414)
---
coverage/htmlfiles/coverage_html.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js
index 084a4970c..ab29b6398 100644
--- a/coverage/htmlfiles/coverage_html.js
+++ b/coverage/htmlfiles/coverage_html.js
@@ -553,7 +553,7 @@ coverage.build_scroll_markers = function () {
'p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par'
).forEach(element => {
const line_top = Math.floor(element.offsetTop * marker_scale);
- const line_number = parseInt(element.id.substr(1));
+ const line_number = parseInt(element.querySelector(".n a").id.substr(1));
if (line_number === previous_line + 1) {
// If this solid missed block just make previous mark higher.
From 070d61caab1bb37854c34155a51ab011fe59e7ff Mon Sep 17 00:00:00 2001
From: Marc Legendre
Date: Sat, 6 Aug 2022 20:13:56 +0200
Subject: [PATCH 015/525] fix(html): trigger filter on page load (#1413)
In the HTML report, if the "filter" input contains a value when
the page loads, it is ignored. This happens even though an event
is actually created on start-up to trigger the refresh.
I believe this is a regression introduced in
9a1954a224c7c0f578513d8f4ca5f821fcf2cf5a, when the observed
events changed from "keyup change" to "input".
---
coverage/htmlfiles/coverage_html.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js
index ab29b6398..1c4eb9881 100644
--- a/coverage/htmlfiles/coverage_html.js
+++ b/coverage/htmlfiles/coverage_html.js
@@ -166,7 +166,7 @@ coverage.wire_up_filter = function () {
// Trigger change event on setup, to force filter on page refresh
// (filter value may still be present).
- document.getElementById("filter").dispatchEvent(new Event("change"));
+ document.getElementById("filter").dispatchEvent(new Event("input"));
};
coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2";
From 774c364b8eddfb53c3da5c8827f27ea279401316 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 14:18:08 -0400
Subject: [PATCH 016/525] doc: keep CHANGES up to date
---
CHANGES.rst | 4 ++++
CONTRIBUTORS.txt | 1 +
2 files changed, 5 insertions(+)
diff --git a/CHANGES.rst b/CHANGES.rst
index 1a50184ac..f3e2cdb88 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -24,11 +24,15 @@ Unreleased
drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
Thanks, Lorenzo Micò.
+- Filtering in the HTML report wouldn't work when reloading the index page.
+ This is now fixed (`pull 1413`_). Thanks, Marc Legendre.
+
- Fix a problem with Cython code measurement (`pull 1347`_, fixing `issue
972`_). Thanks, Matus Valo.
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _pull 1413: https://github.com/nedbat/coveragepy/issues/1413
.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 76b5f5700..d4a1e760f 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -100,6 +100,7 @@ Lex Berezhny
Loïc Dachary
Lorenzo Micò
Marc Abramowitz
+Marc Legendre
Marcelo Trylesinski
Marcus Cobden
Marius Gedminas
From 36f508f98f74b44a1f7aed23f2beecb4189025ca Mon Sep 17 00:00:00 2001
From: earthman1 <30826762+earthman1@users.noreply.github.com>
Date: Sat, 6 Aug 2022 14:57:19 -0400
Subject: [PATCH 017/525] fix: filenames can contain special glob characters
(#1405)
* Fix globbing of filenames that contain special glob characters
* glob the path as well as the filename
---
coverage/data.py | 2 +-
coverage/sqldata.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/coverage/data.py b/coverage/data.py
index b209cf157..4bdfe3010 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -70,7 +70,7 @@ def combinable_files(data_file, data_paths=None):
if os.path.isfile(p):
files_to_combine.append(os.path.abspath(p))
elif os.path.isdir(p):
- pattern = os.path.join(os.path.abspath(p), f"{local}.*")
+ pattern = glob.escape(os.path.join(os.path.abspath(p), local)) +".*"
files_to_combine.extend(glob.glob(pattern))
else:
raise NoDataError(f"Couldn't combine from non-existent path '{p}'")
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index 8d2ed73a5..564d4ec93 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -774,8 +774,8 @@ def erase(self, parallel=False):
file_be_gone(self._filename)
if parallel:
data_dir, local = os.path.split(self._filename)
- localdot = local + ".*"
- pattern = os.path.join(os.path.abspath(data_dir), localdot)
+ local_abs_path = os.path.join(os.path.abspath(data_dir), local)
+ pattern = glob.escape(local_abs_path) + ".*"
for filename in glob.glob(pattern):
if self._debug.should("dataio"):
self._debug.write(f"Erasing parallel data file {filename!r}")
From eaf55921248211a81be231d7d20d73460cb369fb Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 15:02:51 -0400
Subject: [PATCH 018/525] test: add a test for #1405
---
CHANGES.rst | 5 +++++
CONTRIBUTORS.txt | 2 ++
tests/test_data.py | 27 +++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/CHANGES.rst b/CHANGES.rst
index f3e2cdb88..952a975bb 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Fix a failure when combining data files due to file names containing
+ glob-like patterns (`pull 1405`_). Thanks, Michael Krebs and Benjamin
+ Schubert.
+
- Fix a messaging failure when combining Windows data files on a different
drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
Thanks, Lorenzo Micò.
@@ -32,6 +36,7 @@ Unreleased
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _pull 1405: https://github.com/nedbat/coveragepy/issues/1405
.. _pull 1413: https://github.com/nedbat/coveragepy/issues/1413
.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index d4a1e760f..4c6dfaf15 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -23,6 +23,7 @@ Artem Dayneko
Arthur Deygin
Ben Carlsson
Ben Finney
+Benjamin Schubert
Bernát Gábor
Bill Hart
Bradley Burns
@@ -111,6 +112,7 @@ Matthew Boehm
Matthew Desmarais
Matus Valo
Max Linke
+Michael Krebs
Michał Bultrowicz
Mickie Betz
Mike Fiedler
diff --git a/tests/test_data.py b/tests/test_data.py
index 3cb519ca4..8f05ada0d 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -878,6 +878,33 @@ def test_interleaved_erasing_bug716(self):
# "no such table: meta"
covdata2.add_lines(LINES_1)
+ @pytest.mark.parametrize(
+ "dpart, fpart",
+ [
+ ("", "[b-a]"),
+ ("[3-1]", ""),
+ ("[3-1]", "[b-a]"),
+ ],
+ )
+ def test_combining_with_crazy_filename(self, dpart, fpart):
+ dirname = f"py{dpart}"
+ basename = f"{dirname}/.coverage{fpart}"
+ os.makedirs(dirname)
+
+ covdata1 = CoverageData(basename=basename, suffix="1")
+ covdata1.add_lines(LINES_1)
+ covdata1.write()
+
+ covdata2 = CoverageData(basename=basename, suffix="2")
+ covdata2.add_lines(LINES_2)
+ covdata2.write()
+
+ covdata3 = CoverageData(basename=basename)
+ combine_parallel_data(covdata3)
+ assert_line_counts(covdata3, SUMMARY_1_2)
+ assert_measured_files(covdata3, MEASURED_FILES_1_2)
+ self.assert_file_count(glob.escape(basename) + ".*", 0)
+
class DumpsLoadsTest(CoverageTest):
"""Tests of CoverageData.dumps and loads."""
From 41602b5ecfe602c53cef84fec249ed07dbd89538 Mon Sep 17 00:00:00 2001
From: Arthur Rio
Date: Sat, 6 Aug 2022 13:06:25 -0600
Subject: [PATCH 019/525] fix: paths were wrong when running from root (#1403)
* Fix paths when running coverage from root
* Add simple tests
* Use nested pattern for older python versions
---
coverage/files.py | 8 +++++++-
tests/test_files.py | 24 +++++++++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/coverage/files.py b/coverage/files.py
index 507496ffe..b5895cfca 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -24,8 +24,14 @@ def set_relative_directory():
"""Set the directory that `relative_filename` will be relative to."""
global RELATIVE_DIR, CANONICAL_FILENAME_CACHE
+ # The current directory
+ abs_curdir = abs_file(os.curdir)
+ if not abs_curdir.endswith(os.sep):
+ # Suffix with separator only if not at the system root
+ abs_curdir = abs_curdir + os.sep
+
# The absolute path to our current directory.
- RELATIVE_DIR = os.path.normcase(abs_file(os.curdir) + os.sep)
+ RELATIVE_DIR = os.path.normcase(abs_curdir)
# Cache of results of calling the canonical_filename() method, to
# avoid duplicating work.
diff --git a/tests/test_files.py b/tests/test_files.py
index 5588c373d..28a98fb84 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -5,17 +5,14 @@
import os
import os.path
+from unittest import mock
import pytest
-from coverage import env
-from coverage import files
+from coverage import env, files
from coverage.exceptions import ConfigError
-from coverage.files import (
- TreeMatcher, FnmatchMatcher, ModuleMatcher, PathAliases,
- find_python_files, abs_file, actual_path, flat_rootname, fnmatches_to_regex,
-)
-
+from coverage.files import (FnmatchMatcher, ModuleMatcher, PathAliases, TreeMatcher, abs_file,
+ actual_path, find_python_files, flat_rootname, fnmatches_to_regex)
from tests.coveragetest import CoverageTest
@@ -67,6 +64,19 @@ def test_canonical_filename_ensure_cache_hit(self):
assert 'sub/proj1/file1.py' in files.CANONICAL_FILENAME_CACHE
assert files.canonical_filename('sub/proj1/file1.py') == self.abs_path('file1.py')
+ @pytest.mark.parametrize(
+ ["curdir", "sep"], [
+ ("/", "/"),
+ ("X:\\", "\\"),
+ ]
+ )
+ def test_relative_dir_for_root(self, curdir, sep):
+ with mock.patch.object(files.os, 'curdir', new=curdir):
+ with mock.patch.object(files.os, 'sep', new=sep):
+ with mock.patch('coverage.files.os.path.normcase', return_value=curdir):
+ files.set_relative_directory()
+ assert files.relative_directory() == curdir
+
@pytest.mark.parametrize("original, flat", [
("abc.py", "abc_py"),
From 42202a88a1873031118643072a2b946c7ea7e9fb Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 15:10:24 -0400
Subject: [PATCH 020/525] docs: keep CHANGES up to date
---
CHANGES.rst | 4 ++++
CONTRIBUTORS.txt | 1 +
tests/test_files.py | 6 ++++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 952a975bb..e0b2a41ab 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -28,6 +28,9 @@ Unreleased
drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
Thanks, Lorenzo Micò.
+- Fix path calculations when running in the root directory, as you might do in
+ a Docker container: `pull 1403`_, thanks Arthur Rio.
+
- Filtering in the HTML report wouldn't work when reloading the index page.
This is now fixed (`pull 1413`_). Thanks, Marc Legendre.
@@ -36,6 +39,7 @@ Unreleased
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _pull 1403: https://github.com/nedbat/coveragepy/issues/1403
.. _pull 1405: https://github.com/nedbat/coveragepy/issues/1405
.. _pull 1413: https://github.com/nedbat/coveragepy/issues/1413
.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 4c6dfaf15..470dc25f5 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -21,6 +21,7 @@ Arcadiy Ivanov
Aron Griffis
Artem Dayneko
Arthur Deygin
+Arthur Rio
Ben Carlsson
Ben Finney
Benjamin Schubert
diff --git a/tests/test_files.py b/tests/test_files.py
index 28a98fb84..9f7f62784 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -11,8 +11,10 @@
from coverage import env, files
from coverage.exceptions import ConfigError
-from coverage.files import (FnmatchMatcher, ModuleMatcher, PathAliases, TreeMatcher, abs_file,
- actual_path, find_python_files, flat_rootname, fnmatches_to_regex)
+from coverage.files import (
+ FnmatchMatcher, ModuleMatcher, PathAliases, TreeMatcher, abs_file,
+ actual_path, find_python_files, flat_rootname, fnmatches_to_regex,
+)
from tests.coveragetest import CoverageTest
From 0915b967461661654ae2d1a85bd0495c2eafd35b Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 15:11:12 -0400
Subject: [PATCH 021/525] docs: correct a reference
---
CHANGES.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index e0b2a41ab..c9f2a3605 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -42,7 +42,7 @@ Unreleased
.. _pull 1403: https://github.com/nedbat/coveragepy/issues/1403
.. _pull 1405: https://github.com/nedbat/coveragepy/issues/1405
.. _pull 1413: https://github.com/nedbat/coveragepy/issues/1413
-.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
+.. _issue 1428: https://github.com/nedbat/coveragepy/issues/1428
.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
From 616d963b390e94e12a9321b32e10c00e6da4e27d Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 15:15:56 -0400
Subject: [PATCH 022/525] docs: better wording in CHANGES
---
CHANGES.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index c9f2a3605..d04e2905c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,7 +20,7 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
-- Fix a failure when combining data files due to file names containing
+- Fix a failure when combining data files if the file names contained
glob-like patterns (`pull 1405`_). Thanks, Michael Krebs and Benjamin
Schubert.
From 1da23c5bec55264ac4d754cb1c19322297ecdbdd Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 16:32:21 -0400
Subject: [PATCH 023/525] docs: prep for 6.4.3
---
CHANGES.rst | 6 ++++--
README.rst | 2 +-
coverage/version.py | 2 +-
doc/conf.py | 6 +++---
doc/index.rst | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index d04e2905c..1661f44fa 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -17,8 +17,10 @@ development at the same time, such as 4.5.x and 5.0.
.. Version 9.8.1 — 2027-07-27
.. --------------------------
-Unreleased
-----------
+.. _changes_6-4-3:
+
+Version 6.4.3 — 2022-08-06
+--------------------------
- Fix a failure when combining data files if the file names contained
glob-like patterns (`pull 1405`_). Thanks, Michael Krebs and Benjamin
diff --git a/README.rst b/README.rst
index ba797badb..8ae8ec59d 100644
--- a/README.rst
+++ b/README.rst
@@ -27,7 +27,7 @@ Coverage.py runs on these versions of Python:
.. PYVERSIONS
-* CPython 3.7 through 3.11.0b4.
+* CPython 3.7 through 3.11.0b5.
* PyPy3 7.3.8.
Documentation is on `Read the Docs`_. Code repository and issue tracker are on
diff --git a/coverage/version.py b/coverage/version.py
index cb4b80a26..fd7d0dec0 100644
--- a/coverage/version.py
+++ b/coverage/version.py
@@ -5,7 +5,7 @@
# This file is exec'ed in setup.py, don't import anything!
# Same semantics as sys.version_info.
-version_info = (6, 4, 3, "alpha", 0)
+version_info = (6, 4, 3, "final", 0)
def _make_version(major, minor, micro, releaselevel, serial):
diff --git a/doc/conf.py b/doc/conf.py
index f671ef4e3..cca823166 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -64,11 +64,11 @@
# built documents.
#
# The short X.Y.Z version. # CHANGEME
-version = "6.4.2"
+version = "6.4.3"
# The full version, including alpha/beta/rc tags. # CHANGEME
-release = "6.4.2"
+release = "6.4.3"
# The date of release, in "monthname day, year" format. # CHANGEME
-release_date = "July 12, 2022"
+release_date = "August 6, 2022"
rst_epilog = """
.. |release_date| replace:: {release_date}
diff --git a/doc/index.rst b/doc/index.rst
index fd2b2b8c2..8bc8e83dd 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -18,7 +18,7 @@ supported on:
.. PYVERSIONS
-* Python versions 3.7 through 3.11.0b4.
+* Python versions 3.7 through 3.11.0b5.
* PyPy3 7.3.8.
From 85a49efa75916f3b96a3f21d8be98516d38fb760 Mon Sep 17 00:00:00 2001
From: Ned Batchelder
Date: Sat, 6 Aug 2022 16:33:26 -0400
Subject: [PATCH 024/525] docs: latest sample
---
doc/sample_html/coverage_html.js | 4 ++--
doc/sample_html/d_7b071bdc2a35fa80___init___py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80___main___py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_backward_py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_cogapp_py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_makefiles_py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_test_cogapp_py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_test_makefiles_py.html | 8 ++++----
.../d_7b071bdc2a35fa80_test_whiteutils_py.html | 8 ++++----
doc/sample_html/d_7b071bdc2a35fa80_whiteutils_py.html | 8 ++++----
doc/sample_html/index.html | 8 ++++----
doc/sample_html/status.json | 2 +-
12 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/doc/sample_html/coverage_html.js b/doc/sample_html/coverage_html.js
index 084a4970c..1c4eb9881 100644
--- a/doc/sample_html/coverage_html.js
+++ b/doc/sample_html/coverage_html.js
@@ -166,7 +166,7 @@ coverage.wire_up_filter = function () {
// Trigger change event on setup, to force filter on page refresh
// (filter value may still be present).
- document.getElementById("filter").dispatchEvent(new Event("change"));
+ document.getElementById("filter").dispatchEvent(new Event("input"));
};
coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2";
@@ -553,7 +553,7 @@ coverage.build_scroll_markers = function () {
'p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par'
).forEach(element => {
const line_top = Math.floor(element.offsetTop * marker_scale);
- const line_number = parseInt(element.id.substr(1));
+ const line_number = parseInt(element.querySelector(".n a").id.substr(1));
if (line_number === previous_line + 1) {
// If this solid missed block just make previous mark higher.
diff --git a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
index 70cd698cc..86f3695e2 100644
--- a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
+++ b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
@@ -66,8 +66,8 @@