Repository navigation
Releases
7.17.3
Version 7.17.3 — 2026-11-11
- Fix: using
patch = fork, a child process wasn’t measured unlesspatch = subprocesswas also used, as described in issue 2340. This is now fixed in pull 2342. - Fix: the JSON report keys functions and classes by name, but names can repeat, for example a property getter and setter. Only the last one was kept, so the others were missing from the report. Now repeated names get a
@<line number>suffix, as in the LCOV report. pull 2353. - Fix: when combining parallel data files, a file that disappears after it has been listed (for example, when the process writing it is still finishing its write) is now reported with a warning, instead of stopping the combine with a
DataError. This was a regression in 7.17.1. Closes issue 2364. - Fix: with
patch = subprocesson Python 3.13, a measured subprocess that was stopped with SIGINT would exit with status 1 instead of dying from the signal. This was a regression in 7.17.1, and is now fixed, closing issue 2362. - Performance: on Python 3.13 and later, using the C tracer should result in test suites running about 8% to 12% faster (pull 2371).
➡️ PyPI page: coverage 7.17.3.
➡️ To install: python3 -m pip install coverage==7.17.3
7.17.2
Version 7.17.2 — 2026-11-04
- Fix: two different scenarios failed with “attempt to write a readonly database”. These were regressions in 7.17.1. They are fixed, closing issue 2356:
- When using a version of SQLite older than 3.34.0, such as on RHEL 8 or Ubuntu 20.04,
coverage combine(and pytest-cov, which combines automatically) always failed. coverage combineandcoverage debug datafailed when a data file existed but had no coverage schema, for example an empty file left behind by a worker that died. A file we can’t read is now reported like any other unusable data file, and is left in place.
- When using a version of SQLite older than 3.34.0, such as on RHEL 8 or Ubuntu 20.04,
➡️ PyPI page: coverage 7.17.2.
➡️ To install: python3 -m pip install coverage==7.17.2
7.17.1
Version 7.17.1 — 2026-11-03
- Fix: a one-line class or function body immediately followed by another statement (such as
class Foo: ...on its own line) was incorrectly reported as a missing branch when using the sys.monitoring core. This is now fixed, closing issue 2167 and issue 2337. - Fix: the HTML report only rewrites a file’s page when the file or its data has changed, but each page also links to the previous and next files. When the set of reported files changed, unchanged pages kept their old links. For example, with
skip_covered, a file that became 100% covered had its page deleted, but the pages next to it still linked to it. Now a page is also rewritten when its neighbors change. - Fix:
--fail-undernow uses at least the decimal precision of the threshold for both the comparison and failure message. Withprecision=0, a total of 0.4 now passes--fail-under=0.3and fails--fail-under=0.5with the message “total of 0.4 is less than fail-under=0.5”. Previously, the comparison rounded the total to zero and the message could claim “1 is less than 0”. Closes issue 2295. - Fix: the HTML report escaped file names twice, so a name with
&,<, or quotes in it was shown with entities like&. Now they are properly escaped only once. - Fix:
--source=/measured no files. A file system root can’t be a source directory, so now it is an error. Closes issue 2291. - In an abundance of caution, prevent forged SQLite journal files from deleting files they shouldn’t.
➡️ PyPI page: coverage 7.17.1.
➡️ To install: python3 -m pip install coverage==7.17.1
7.17.0
Version 7.17.0 — 2026-10-22
- Dropped support for Python 3.10.
- Binary wheels are now provided for iOS and Android. This allows the use of the optimized C tracer on mobile platforms.
- Fix: three or more levels of nested
withstatements could make awithline look like a branch with an exit that can never happen. Using the sys.monitoring core, these phantom branches were reported as partial. Other cores hid the problem but still counted the phantom branches in the total. Closes issue 1987. - Fix: a comment or string that merely mentioned
if True:orwhile True:could mark its line as a branch that is known to be partial, so a branch that never ran was reported as taken. These built-in patterns now only match at the start of the statement. Closes issue 2314. - Fix: region detection missed functions defined in unusual places, such as
elseandexceptclauses. This is now fixed. - Fix: recent versions of the lcov tool complain if the same function name appears more than once in a report. Python can have multiple same-named functions in a few ways, for example, getters/setters or conditionally defined functions. These are now disambiguated by adding a
@<line number>suffix to the function name. Fixes issue 2335. - Fix: The “Can’t combine statement coverage data with branch data” error now names the two data files it couldn’t combine. The error description in the docs now lists common causes and how to find the process that wrote the file.
- Fix: at coverage totals close to 0 or 100, the XML report could get incorrect
line-ratevalues like8.333e-05or1. This is now fixed, closing issue 2293 and issue 2294. - Fix: a parallel data file saved more than once kept the hash of its first save in its file name. Combining could then skip it as a duplicate of another file that had the same data at that point, and delete it, losing the data recorded after the first save. Each save now updates the hash. This had been a problem since 7.13.1. Fixes issue 2338.
- Fixes for obscure but legal file names:
- File names (and plugin names) can contain control characters, which are legal in POSIX paths but unsafe in reports: in XML 1.0 they make the document non-well-formed, and in a terminal they act as escape sequences (colors, title/clipboard sequences, cursor moves that forge output). Now the XML report, the text and Markdown summary reports, and
coverage debug datareplace non-printable characters in names. Printable names are unchanged. - A file pattern (from
include,omit, or a[paths]alias) containing a newline sent the glob-to-regex translation into an infinite loop, hanging the process. Newlines in patterns are now handled like any other character.
- File names (and plugin names) can contain control characters, which are legal in POSIX paths but unsafe in reports: in XML 1.0 they make the document non-well-formed, and in a terminal they act as escape sequences (colors, title/clipboard sequences, cursor moves that forge output). Now the XML report, the text and Markdown summary reports, and
- Fixes in the implementation of the C tracer:
- If a plugin’s
dynamic_source_filenamemethod raised an exception, lines in that function could be recorded as belonging to a different file. Also fixed some minor memory leaks in the C tracer. - The refcount of
Nonewas mismanaged during function calls, including comprehensions. This was unlikely to cause an actual problem, but is now fixed. Thanks, Andrew Dalke. - The C tracer held borrowed references to dictionary values, which was unsafe on free-threaded Python. Now it takes its own references.
- An internal error while recording a new file could be reported as a confusing
SystemErrorinstead of the actual exception.
- If a plugin’s
- Performance: the text summary report (
coverage report) held on to every file’s parsed source until it finished, so its memory use grew with the size of the project: ten times or more what 7.14 used on large projects. Now it keeps only what it needs to print. Fixes issue 2277. - Performance: HTML reports should be about 5% faster to produce.
- Kept the political banner in the README. Closes issue 2344.
➡️ PyPI page: coverage 7.17.0.
➡️ To install: python3 -m pip install coverage==7.17.0
7.16.2
Version 7.16.2 — 2026-09-27
- Fix: on Python 3.14 and later, a
forloop completing immediately before a function return could mistakenly report an uncovered branch. This is now fixed, closing issue 2168. - Fix: on Python 3.14 and later, the
elseclause of atrywhose body is awithstatement could incorrectly be reported as covered when thewithraised. This is now fixed, closing issue 2289. - Fix: with
dynamic_context = test_function, test methods written as@staticmethodor@classmethodwere not given a context of their own. Now they are, on Python 3.11 and later. Closes issue 1923.
➡️ PyPI page: coverage 7.16.2.
➡️ To install: python3 -m pip install coverage==7.16.2
7.16.1
Version 7.16.1 — 2026-09-13
- Fix: when the body of an irrefutable
case(likecase _:) is entirely excluded, thecaseline is now excluded too, just as an excludedelse:body removes theelse:line. Previously thecaseline was left behind and reported as missing. Closes issue 1563 with pull 2269. - Fix: using CoverageData.update() twice on an in-memory database would fail, as described in issue 2279. This is now fixed.
- Fix: the Total row in the footer of the HTML report’s index page was recomputed in JavaScript with rounding that could disagree with the total the server rendered in the heading, including showing
100%when coverage was not complete. The footer now clamps values the way the rest of the report does, and when nothing is filtered out it is shown exactly as the server rendered it, so the two can’t disagree. That also keeps rows the report omits (--skip-covereddrops fully covered files) in the total. Fixes issue 2256.
➡️ PyPI page: coverage 7.16.1.
➡️ To install: python3 -m pip install coverage==7.16.1
7.16.0
Version 7.16.0 — 2026-08-28
- When combining files, now path separator slashes will automatically be converted to the local file system style. This makes it less necessary to define
[paths]configuration to combine data across operating systems. Fixes issue 2266. - The Coverage.switch_context() method now returns the previous context.
- Fix: previously, a
[paths]pattern would be replaced everywhere in a file path when it was only meant to be replaced once, in the leading portion of the path. This is now fixed, in pull 2268. - Fixes to validation of options and configuration settings:
- Negative precision settings now always cause useful error messages (pull 2261).
- An invalid regex in the
--contextsoption (or the[report] contextssetting) reported a confusing “Couldn’t use data file …: user-defined function raised exception” error. Now it raises a proper configuration error naming the bad regex, like other regex settings do (pull 2262). - Non-string values in TOML configuration settings now produce a helpful error message instead of a traceback. This affects list settings whose elements aren’t strings (like
omit,exclude_lines, or a[paths]entry), file settings likedata_file, and any wrong-typed value in the[paths]section (pull 2263). coverage runrefuses run-affecting command-line options like--branchalongside--concurrency=multiprocessing, since they can’t reach the subprocesses. The check only recognizedmultiprocessingas the entire option value, so--concurrency=multiprocessing,threadslipped through and failed later with “Can’t combine statement coverage data with branch data”. Each named concurrency library is now properly considered (pull 2270).
- Fix:
coverage annotate -d DIRraised anAssertionErrorif any measured file had an extension other than.py, such as a.pywfile on Windows. The original extension is now restored on the annotated copy (pull 2265).
➡️ PyPI page: coverage 7.16.0.
➡️ To install: python3 -m pip install coverage==7.16.0
7.15.4
Version 7.15.4 — 2026-08-06
- Fix: in the HTML report, a source file name containing a double quote (legal on POSIX) wasn’t escaped where it’s dropped into the
hrefof the index and prev/next links, so it could close the attribute early and inject markup. Page URLs are now escaped. Thanks, Rajath Mohare. - Fix: the LCOV report wrote file names and other fields into its line-oriented records without neutralizing control characters. A measured file whose name contained a newline (legal on POSIX) could forge extra records, inflating the coverage seen by tools that read the report. Control characters in a field are now replaced. Thanks, Rajath Mohare.
- Wheels are now provided for Python 3.15.
➡️ PyPI page: coverage 7.15.4.
➡️ To install: python3 -m pip install coverage==7.15.4
7.15.3
Version 7.15.3 — 2026-08-02
- Fix: the sysmon core is incompatible with dynamic contexts. Previously, the combination would be prevented when read from the coverage.py configuration. But using the context API as pytest-cov does, contexts would be silently dropped. Now a warning is issued, thanks to Jisang Han. Closes issue 2200.
- A performance improvement in the low-level line number bookkeeping when combining data files, thanks to Kevin Turcios.
- Performance improvement in HTML reporting by reducing the number of times files have to be parsed, thanks to Kevin Turcios.
➡️ PyPI page: coverage 7.15.3.
➡️ To install: python3 -m pip install coverage==7.15.3
7.15.2
Version 7.15.2 — 2026-07-15
- Fix: one of the performance improvements in 7.15.1 (pull 2215) dramatically increased memory use during reporting for large projects. Now we use a different approach that is both faster and slimmer than 7.15.0. Fixes issue 2229.
➡️ PyPI page: coverage 7.15.2.
➡️ To install: python3 -m pip install coverage==7.15.2