Repository navigation
Run the test suite in parallel with pytest-xdist - #861
Merged
Merged
Conversation
tools/vocab/build.py read nameparser/_lexicon.py from ROOT at first use, and three tests in tests/v2/test_vocab.py repoint ROOT at a fixture tree holding no such file. Each passed only because an earlier test had already filled the cache, and failed when run alone (exit 3 for 1 or 2). The path is now bound at import, like VOCAB and OUTPUT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`-n auto --dist worksteal` in addopts: 110s serial to 35s on this machine (12 cores; measured 2026-10-23). worksteal because the property grids are a few long tests among 23,000 short ones. The clock-timed scaling guards in tests/v2/test_benchmark.py cannot share the CPU with other workers: maiden_clause read 6.4x against its 6.0 bound under -n auto. The module is marked `serial`, tests/conftest.py deselects serial tests in a parallel run's workers and says so in the summary, and CI runs them in a second `-n0 -m serial` pass (with --cov-append in the coverage job). `-n0` still runs everything in one process. AGENTS.md and CONTRIBUTING.md give both commands; AGENTS.md also drops the stale "runs every test twice" description of the conftest fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #861 +/- ##
=======================================
Coverage 99.05% 99.05%
=======================================
Files 47 47
Lines 4669 4669
=======================================
Hits 4625 4625
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
-n auto --dist workstealin pyproject'saddopts. On a 12-core Mac the full suite went from 110s serial to 35s (measured 2026-10-23). worksteal because the property grids are a few long tests among 23,000 short ones. With--dist loadfile,test_properties.pyalone set the wall time (66s).-n auto,maiden_clauseread 6.4× against its 6.0 bound on a tree that passes serially.tests/v2/test_benchmark.pyis markedserial.tests/conftest.pydeselectsserialtests in a parallel run's workers and prints a summary line saying how to run them:uv run pytest -n0 -m serial.-n0still runs everything in one process.-n0 -m serial. The coverage job adds--cov-appendto the second pass, and the ja-extra job keepsNAMEPARSER_REQUIRE_CLOCK_GUARDSon both passes.tools/vocab/build.pyread_lexicon.pyfromROOTat first use. Threetest_vocab.pytests repointROOTat a fixture tree, so each passed only after an earlier test had warmed the cache, and failed when run alone. The path is now bound at import, likeVOCABandOUTPUT. A new test fails against the old loader.Verification
uv run pytest: 23,162 passed, 125 skipped, 3 xfailed in 35s.uv run pytest -n0 -m serial: 39 passed.uv run pytest -n0: 23,201 passed, which is the two passes combined.-n 3 --dist loadand-n 11, with every test module run on its own.--covrun. That serial run took 4:45 under the 3.11 line tracer; the parallel one took 1:20.ruff checkandmypyare clean.Not verified locally: the ja-extra job's parallel pass, since namedivider isn't installed here, and CI's 4-vCPU runners, where the gain will be smaller than on 12 cores.
🤖 Generated with Claude Code