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