Skip to content

ci: parallelize tests with pytest-xdist and close CI gaps#9

Merged
yarikoptic merged 1 commit into
mainfrom
opt-pytest-xdist
Apr 21, 2026
Merged

ci: parallelize tests with pytest-xdist and close CI gaps#9
yarikoptic merged 1 commit into
mainfrom
opt-pytest-xdist

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

ci: parallelize tests with pytest-xdist and close CI coverage gaps

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 Initial design + implementation (round 2): migration engine, annex correctness, dedup #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

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>
@yarikoptic yarikoptic added the tests Add or improve existing tests label Apr 21, 2026
@yarikoptic yarikoptic merged commit 61bb497 into main Apr 21, 2026
5 checks passed
@yarikoptic yarikoptic deleted the opt-pytest-xdist branch April 21, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Add or improve existing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant