pypi / coverage
coverage
What changed in coverage 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-29.
10 breaking4 security2 deprecations7 new APIs and options8 performance7 behavior and defaults3 tooling57 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcoverage 798 changes
Breaking changes 10
Using a file system root as a source directory now produces an error instead of measuring no files.
Built-in patterns only match at the start of a statement, so comments or strings mentioning these patterns no longer mark branches as partial.
Support for Python 3.10 has been dropped.
When combining files, path separator slashes are converted to the local file system style, reducing the need for [paths] configuration across operating systems.
The project no longer distributes wheels for Python 3.13 free-threaded.
Reporting commands now implicitly combine parallel data files before creating a report; there is no option to avoid the combination.
Directories on sys.path inside a virtualenv are now considered third-party code, preventing them from being measured and slowing test execution.
SQLite debugging information is no longer included in the sys debug output because it is bulky and not very useful.
When the core defaults to sysmon but settings conflict with it, coverage uses ctrace without a warning. Explicitly requesting sysmon with conflicting settings now raises an error instead of a warning.
Support for Python 3.9 was dropped.
Security 4
Prevents forged SQLite journal files from deleting files they shouldn’t.
Page URLs are now escaped in the index and prev/next links, preventing file names containing double quotes from injecting markup.
Control characters in fields are now replaced, preventing file names containing newlines from forging records and inflating reported coverage.
Context labels are now fully escaped when show_contexts is enabled, preventing labels containing </script> from closing the inline script element and injecting markup.
Deprecations 2
The coverage-3.10 command entry point still works but prints a deprecation message and will eventually be removed.
The coverage3 command entry point still works but prints a deprecation message and will eventually be removed.
New APIs and options 7
Reporting commands can retain parallel data files after combining them instead of deleting them.
This new option displays the detailed lines about files considered that the command no longer prints by default.
The command now accepts file names as command-line arguments, allowing inspection of specific data files without setting COVERAGE_FILE.
The JSON report now includes start_line for function and class regions, indicating the first line of each region in the source.
coverage.py now supports TOML configuration files, which take priority over pyproject.toml but lower priority than .coveragerc files.
Includes separate statement and branch coverage totals.
Adds the core debug option to show which measurement core is in use and why.
Performance 8
On Python 3.13 and later, using the C tracer should make test suites run about 8% to 12% faster.
The text summary report keeps only the parsed source it needs to print, reducing memory use on large projects.
HTML reports should be about 5% faster to produce.
Low-level line number bookkeeping is faster when combining data files.
HTML reporting parses files fewer times, improving performance.
Reporting for large projects uses an approach that is faster and uses less memory than 7.15.0.
The release includes a number of performance improvements.
Data files being combined now record their hash in the file name, allowing duplicate data to be skipped more quickly.
Behavior and default changes 7
With
dynamic_context = test_function, staticmethod and classmethod test methods receive a context of their own on Python 3.11 and later.Using dynamic contexts with the sysmon core through the context API now issues a warning instead of silently dropping contexts.
The command now prints one line with counts of files combined, skipped, and errored instead of listing each file considered.
The flag now suppresses the command's single summary line.
The soft keyword lazy is now bolded in HTML reports.
Uses thin spaces around slashes in file paths to make them easier to read.
When the requested measurement core conflicts with other settings, another core is used and a warning is issued instead of raising an error.
Tooling 3
Binary wheels for iOS and Android allow use of the optimized C tracer on mobile platforms.
Wheels are now published for ppc64le.
Shows separate statement and branch coverage totals alongside the combined coverage percentage.
Fixes and other changes 57
When a listed parallel data file disappears during combining, coverage now reports a warning instead of stopping with a DataError.
Repeated function and class names now receive an @<line number> suffix so they are not lost from the report.
Child processes are now measured when using patch = fork, without also requiring patch = subprocess.
On Python 3.13, a measured subprocess stopped with SIGINT now dies from the signal rather than exiting with status 1.
Combining coverage data now works with SQLite versions older than 3.34.0, including versions on RHEL 8 and Ubuntu 20.04.
A data file without a coverage schema is reported as an unusable data file and left in place.
A data file without a coverage schema is reported as an unusable data file and left in place.
The comparison and failure message use at least the threshold’s decimal precision, avoiding rounded totals that produce incorrect results or messages.
Pages are rewritten when their neighboring files change, keeping previous- and next-file links current when the set of reported files changes.
File names containing ampersands, angle brackets, or quotes are escaped only once when displayed.
One-line class or function bodies followed by another statement are no longer incorrectly reported as missing branches when using the sys.monitoring core.
The error now identifies the two data files that could not be combined.
If a plugin method raises an exception, lines in that function are no longer recorded as belonging to a different file.
Newlines in file patterns are handled as ordinary characters instead of hanging the process during glob-to-regex translation.
An internal error while recording a new file is now reported as the actual exception instead of a confusing SystemError.
Duplicate function names are disambiguated with a line-number suffix to avoid complaints from recent lcov versions.
Three or more levels of nested with statements no longer create phantom partial branches or inflate branch totals.
XML, text, and Markdown summary reports, and coverage debug data, replace non-printable characters in file and plugin names.
Each save updates the file hash, preventing combining from skipping a file as a duplicate and losing data recorded after its first save.
Region detection now finds functions defined in unusual locations, including else and except clauses.
XML reports now avoid incorrect line-rate values when coverage totals are close to 0 or 100.
On Python 3.14 and later, a for loop immediately before a function return no longer mistakenly reports an uncovered branch.
On Python 3.14 and later, the else clause of a try whose body is a with statement is no longer incorrectly reported as covered when the with raises.
Calling CoverageData.update() twice on an in-memory database no longer fails.
When an irrefutable case body is entirely excluded, the case line is now excluded too, so it is no longer reported as missing.
An invalid regex now raises a proper configuration error naming the bad regex instead of a confusing data-file error.
Annotated copies now preserve the original extension, avoiding an AssertionError for measured files with extensions other than .py.
Each named concurrency library is considered when refusing run-affecting options that cannot reach subprocesses.
A [paths] pattern is now replaced only once, in the leading portion of a file path.
Negative precision settings now produce useful error messages.
Non-string values in TOML settings now produce helpful error messages instead of tracebacks, including list settings, file settings, and values in [paths].
Wheels are now provided for Python 3.15.
With Python 3.10 isolated mode, coverage now correctly omits the current directory from the module search path.
Excluded functions are no longer incorrectly counted as uncovered.
Coverage now sets the module loader while running your program, avoiding a deprecation warning.
On 3.13t, coverage no longer incorrectly issues C tracer import errors when the C tracer cannot be imported.
The default ... exclusion rule now matches function bodies whose closing return-type bracket is on its own line.
When using sys.monitoring, coverage now searches for a usable tool id instead of assuming it can use COVERAGE_ID.
Messages are now written to stderr, so
coverage json -o -can be used to capture JSON output from stdout.SQLite connections belonging to terminated threads are now closed and dropped, preventing file descriptor leaks during long runs with many short-lived threads.
File paths in the HTML report can now be searched with slashes because spacing around slashes is added with CSS.
Running a Python file through a symlink now sets sys.path correctly, matching regular Python behavior.
The C extension now builds on VS2019.
Fixed a memory leak when repeatedly using the Coverage API with in-memory data.
Special characters in file paths are now fully escaped in markdown-formatted coverage reports.
Coverage no longer fails with “RuntimeError: Set changed size during iteration” in test suites that change sys.path.
Coverage no longer raises PermissionError when a parent directory is unreadable while examining directories where coverage was run.
When a data file has no read permissions, the combine step now issues a warning and skips the file instead of failing completely.
Standard library files are no longer incorrectly included in coverage reports when Python is installed via symlinks.
Module docstrings are no longer reported as executed lines, matching the behavior of other reports.
Fixes handling of except* clauses under the sysmon measurement core, which could cause KeyError exceptions.
Defends against aggressive mocking of open() that could cause errors inside coverage.py.
Fixes failures when coverage.py tries to open source files after a test suite exhausts the system’s file descriptors.
Fixed a NotPython exception when Python code was claimed to come from a non-Python file while using the sysmon measurement core.
Fixes breakpoint() stopping one frame lower than expected when running in pytest under coverage by reverting a coverage change from v6.4.1.
Fixes incorrect claims of missing branches for some multi-line case clauses, for loops, and probably other constructs when using the sys.monitoring core.
Support for Python 3.15 alpha was declared.