perf(ci): run tests in parallel via pytest-xdist - #45
Merged
Merged
Conversation
The test job ran serially (13m44s on ubuntu). pytest-xdist -n auto cuts the local suite from 197s to 71s (x2.76 on 12 cores); CI runners have 4 cores, so the job time drops proportionally. Both OSes keep the exact same test command, so coverage of ubuntu+windows is unchanged. Coverage moves to .coveragerc.ci (COVERAGE_RCFILE): the local .coveragerc sets dynamic_context=test_function, which pytest-cov rejects under xdist (DistCovError, pytest-cov#604) and which costs ~+13.6% (sys.settrace, AGENT_DIARY 2026-09-15). CI only needs the % gate, so it uses the context-free config; local and bootstrap runs keep contexts. Also cache the temporal facts generator per module (36.6s -> 20.8s): the three tests share one deterministic dataset but each re-ran generate(), which spawns dozens of git subprocesses. Measured locally (12 cores): serial 197.1s -> xdist 71.4s (no cov) -> xdist + ci-cov 86.4s; 1865 passed, coverage 54.58% (> 38% gate).
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The CI test job ran serially (ubuntu 13m44s, windows 16m34s). It now runs
pytest-xdistwith-n auto.Measurement (local, 12 cores, 1865 tests)
-n auto(no cov)-n auto+ coverage (CI shape)All green:
1865 passed, 5 skipped, coverage 54.58% (gate 38%).Quality preserved
-n autoonly parallelizes; no marker exclusions, no--exitfirst, no sharding.Coverage config
The local
.coveragercsetsdynamic_context=test_function(per-test contexts used by the bootstrap pipeline), which pytest-cov rejects under xdist (DistCovError, pytest-cov#604) and which costs ~+13.6% (sys.settrace, AGENT_DIARY 2026-09-15). CI only needs the--cov-fail-undergate, so it now uses the shipped context-free.coveragerc.civiaCOVERAGE_RCFILE. Local/bootstrap runs keep.coveragerc(still gitignored).Also
tests/test_temporal_facts_generator.py: the three tests shared one deterministic dataset but each re-rangenerate(seed=7)(dozens of git subprocesses). A module-scoped fixture cuts it 36.6s -> 20.8s.test_deterministic_generationstill callsgeneratetwice on purpose.Deps
pytest-xdist>=3.5.0to thedevextra.