ci: parallelize tests with pytest-xdist and close CI gaps#9
Merged
Conversation
Two orthogonal improvements bundled for one round trip:
1. Parallelize pytest via pytest-xdist
- Add `pytest-xdist>=3.0` to the `test` extras.
- Default tox `[testenv]` command to
`pytest -n 6 --dist loadscope tests/`, still overridable via
posargs (`tox -e py312 -- tests/test_cli.py`,
`tox -e py312 -- -n 0 tests/test_migrate.py::TestX` both work).
- `loadscope` chosen after measuring: it groups by class/module so
parametrized integration sweeps and the `_register_synthetic_2x_rules`
class-scoped fixture stay on one worker. `loadfile` was ~2x slower
on the current suite.
- Hazard audit: only `monkeypatch.chdir` is used (per-process safe);
`_RULES` mutation in `_register_synthetic_2x_rules` is class-local
and no test outside `TestMigrate20` reads those synthetic rules, so
xdist process isolation is fine.
2. Close CI coverage gaps asserted in PR #7's test plan
- Add `"3.14"` to the workflow matrix.
- Add `duplication` to the 3.12 `[gh-actions]` entry so pylint
duplicate-code actually runs in CI (previously only listed in
`envlist` locally).
- Install `git-annex` via apt before the tox run so the
`@requires_git_annex` integration tests exercise both plain-git and
git-annex paths.
Co-Authored-By: Claude Code 2.1.116 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
ci: parallelize tests with pytest-xdist and close CI coverage gaps
Two orthogonal improvements bundled for one round trip:
Parallelize pytest via pytest-xdist
pytest-xdist>=3.0to thetestextras.[testenv]command topytest -n 6 --dist loadscope tests/, still overridable viaposargs (
tox -e py312 -- tests/test_cli.py,tox -e py312 -- -n 0 tests/test_migrate.py::TestXboth work).loadscopechosen after measuring: it groups by class/module soparametrized integration sweeps and the
_register_synthetic_2x_rulesclass-scoped fixture stay on one worker.
loadfilewas ~2x sloweron the current suite.
monkeypatch.chdiris used (per-process safe);_RULESmutation in_register_synthetic_2x_rulesis class-localand no test outside
TestMigrate20reads those synthetic rules, soxdist process isolation is fine.
Close CI coverage gaps asserted in PR Initial design + implementation (round 2): migration engine, annex correctness, dedup #7's test plan
"3.14"to the workflow matrix.duplicationto the 3.12[gh-actions]entry so pylintduplicate-code actually runs in CI (previously only listed in
envlistlocally).git-annexvia apt before the tox run so the@requires_git_annexintegration tests exercise both plain-git andgit-annex paths.
Co-Authored-By: Claude Code 2.1.116 / Claude Opus 4.7 (1M context) noreply@anthropic.com