Repository navigation
Use sysmon for coverage on Python 3.12 - #970
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #970 +/- ##
=======================================
Coverage 89.55% 89.55%
=======================================
Files 143 143
Lines 14147 14147
=======================================
Hits 12669 12669
Misses 1478 1478 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4444ab8 to
3609c8c
Compare
|
Tests that sometimes took more than 20 minutes have certainly become faster, but the "memory leak tests" discussed in #971 still fail intermittently. I don't know whether setting |
13877d6 to
911012d
Compare
Use coverage.py's sys.monitoring-based measurement core only in the Python 3.12 unit-test matrix jobs. This avoids the significant overhead of the traditional tracing core on Python 3.12 while preserving the existing coverage behavior for every other Python version. The project does not enable branch coverage, which sysmon does not support on Python 3.12.
Some unit-test combinations are flaky, and canceling the matrix on the first failure makes reruns harder to complete. Keep the in-flight variants running so we can collect the remaining signal and retry only the genuinely broken cases.
Tests that sometimes took more than 20 minutes have certainly become faster, but the "memory leak tests" discussed in enthought#971 still fail randomly. As a temporary workaround, skip `TestInproc_win32com.test_eval` on Python 3.12 in addition to Python >= 3.14.
3847c9a to
a7372f2
Compare
|
The reason for merging this PR, which includes First, the assertions in the memory leak tests may be wrong. Even if the tests are not wrong and are not liar tests, we can still run them on other Python versions. Also, these tests are related to a feature that works with a third-party system. Also, the tests on Python 3.12 with These changes do not mean that we have found or fixed the cause of the memory leak test failures. |
Summary
Set
COVERAGE_CORE=sysmononly in the Python 3.12 coverage test step.The idea came from python-pillow/Pillow#7820.
Why this is faster
The normal coverage core uses
sys.settrace. Python 3.12 makes this kind of tracing very slow.sysmonuses Python's newersys.monitoringAPI.It gets line events from Python with less extra work, so the test job can finish faster.
Coverage safety
This project uses line coverage. It does not enable branch coverage.
sysmonon Python 3.12 records line events, so it checks the same kind of coverage as before.The test command, the
comtypessource scope, and the omitted generated files do not change.A line that the tests do not run is still reported as missing.
In other words, this change should not make line coverage report a false pass for an untested line.
sysmoncannot measure branch coverage on Python 3.12.This is safe here because branch coverage is not enabled.
If we enable branch coverage later, we must not use
sysmonfor the Python 3.12 coverage job.Scope
sysmon.