-
Couldn't load subscription status.
- Fork 232
Update coveragepy and use sys.monitoring interface #7042
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7042 +/- ##
==========================================
- Coverage 79.30% 77.60% -1.69%
==========================================
Files 566 566
Lines 43876 43498 -378
==========================================
- Hits 34790 33754 -1036
- Misses 9086 9744 +658 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3c7f9bd to
16d40d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long to get back here, had some other tasks going on. Thanks for the changes! Just wondering if we can already pin coverage it to 7.11 by now? Apart from that, LGTM.
pyproject.toml
Outdated
| 'pytest-xdist~=3.6', | ||
| 'pympler~=1.0', | ||
| 'coverage~=7.0', | ||
| 'coverage~=7.10', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By now, could even be 7.11 (released 15 Oct)? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't put 7.11 as minimum version since it dropped Python 3.9 support. But I've updated the lockfile so that this version is used with Python 3.13, which we use in CI.
But ultimately, we don't need to depend on coverage directly, since we're running in via pytest-cov plugin. So I've bumped pytest-cov plugin to latest version, which sets the minimum coverage version to 7.10.6: https://pytest-cov.readthedocs.io/en/latest/changelog.html#id1
In general, collecting code coverage with `pytest --cov` makes the test suite run quite a bit slower. However, the new version of coveragepy allows to use a different approach based on the new sys.monitoring interface (3.12+) which is much faster (almost free), see: https://nedbatchelder.com/blog/202312/coveragepy_with_sysmonitoring.html
16d40d3 to
3125c28
Compare
This reverts commit 3125c28.
Looks like a flaky test, I've rerun the job. |
In general, collecting code coverage (
pytest --cov) makes the test suite run quite a bit slower.However, the new version of
coveragepyallows to use a different approach based on the newsys.monitoringinterface (3.12+) which is much faster (almost free), see https://nedbatchelder.com/blog/202312/coveragepy_with_sysmonitoring.htmlhttps://coverage.readthedocs.io/en/7.10.7/config.html#run-core
Besides that,
if TYPE_CHECKING:blocks are now automatically ignored, resulting in a "increase" of overall coverage (less uncovered lines of code).This PR drops the runtime of the Py3.9(psql) job from 26 to 20 minutes! 🎉