- Notifications
You must be signed in to change notification settings - Fork1.2k
Adjust Python coverage test flags inpyprompt.toml for slight speedup#7777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
As of mid-2025, this feature is available in Python 3.12 and higher, andis reported to help speed up coverage tests.
codecovbot commentedNov 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@## main #7777 +/- ##==========================================- Coverage 99.57% 90.94% -8.63%========================================== Files 1102 70 -1032 Lines 98425 3590 -94835 ==========================================- Hits 98006 3265 -94741+ Misses 419 325 -94 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
By changing `include` and `omit` values for `tool.coverage.run`, we canlimit the files that pytest-cov scans to look foir tests and therebygain a slight speedup. (I'm seeing 5% faster times on a Linux systemwhen running with `-n 32`.)
sysmon flag for coverage tests to pyprompt.tomlpyprompt.toml for slight speedup
Uh oh!
There was an error while loading.Please reload this page.
This provides some slight speedups to Pytest coverage testing by making 2 changes:
Add a pytest flag to
pyproject.tomlto use sys.monitoring if it is available. This can speed upcoverage.py. The reason is thatsys.monitoring(introduced in Python 3.12 via PEP 669) offers a more efficient way to monitor program execution, potentially leading to faster coverage measurement, especially for line coverage. This feature is only available for Python 3.12+, but it can be turned on always and warnings aboutnot having the sysmon feature can be ignored. Example of a project that found it useful:https://blog.trailofbits.com/2025/05/01/making-pypis-test-suite-81-faster/Change the directories included and excluded to be more selective and get only the directories that have Python test files consumed by Pytest. By changing
includeandomitvalues fortool.coverage.run, I get a small but consistent ~5% speedup (on a Linux system when running with-n 32).