Skip to content

Commit d6e25ef

Browse files
committed
Fix 42-minute test-3.12 CI runs with coverage sysmon core
CPython 3.12's settrace-based tracing is pathologically slow under coverage (CPython gh-107674, coverage.py #1665), making pytest --cov take ~42 minutes on the 3.12 matrix job vs ~40 seconds elsewhere. Export COVERAGE_CORE=sysmon on Python 3.12+ so coverage uses the sys.monitoring core; guarded because sysmon does not exist on <=3.11. Verified locally: full suite on 3.12 with coverage drops from ~42 min to 3.6 s with identical line-coverage results.
1 parent 18e2d3b commit d6e25ef

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.circleci/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ jobs:
1616
pip install -e ".[dev]"
1717
- run:
1818
name: Run tests with coverage
19-
command: pytest --cov=pyqrc --cov-report=xml -v
19+
command: |
20+
# CPython 3.12's settrace is pathologically slow under coverage
21+
# (gh-107674); the sys.monitoring core avoids it but only exists
22+
# on 3.12+.
23+
if python -c 'import sys; sys.exit(sys.version_info < (3, 12))'; then
24+
export COVERAGE_CORE=sysmon
25+
fi
26+
pytest --cov=pyqrc --cov-report=xml -v
2027
- run:
2128
name: Upload coverage to Codecov (non-blocking)
2229
command: |

0 commit comments

Comments
 (0)