Skip to content

test: run the Python tests in parallel with pytest-xdist - #223

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/332-run-the-python-tests-in-parallel-if-poss
Nov 1, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/332-run-the-python-tests-in-parallel-if-poss

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Python suites now run in parallel with pytest-xdist (-n auto --dist worksteal, one worker per CPU) in every CI pytest step and in make test / make test-fast, as fanferro does since its #249; a plain uv run pytest stays serial so a single test is still easy to debug. Each worker starts its own MiniStack, which is safe because every test already uses unique names and emulator clients get a per-test table prefix: nothing in the suite needed changing. CI also prints the 15 slowest tests, and the emulator fixture now waits for MiniStack after killing it (fanferro hit a ResourceWarning there under load).

The gain is smaller than fanferro's, since dynamoxy's suite is already fast: in the 4-CPU sandbox the full suite (989 tests, with MiniStack) went from 11 s serial to about 6 s on 4 workers, with or without coverage. On CI the pytest step went from 17–28 s to 11–18 s on Linux, 10–16 s to 8–11 s on macOS and 19–24 s to 14–18 s on Windows, and the uvloop step from 7 s to 3 s; the jobs' totals are dominated by uv sync building the extension. I ran the suite three times on 4 workers with coverage, once on 8 workers, once on uvloop and once without the emulator, and every run passed.

Worth confirming

  • Decision: Parallel runs for the macOS and Windows jobs too (they spawn worker processes, which costs a little startup); they are the slowest Python jobs, so they have the most to gain.

fctl session


Note

Low risk. It only changes how the test suite is run (a dev dependency, CI steps, make targets and docs) and adds a wait() after killing the test emulator; no library code changes.

What it does. Runs the Python tests in parallel with pytest-xdist (-n auto --dist worksteal) in every CI pytest step and in make test and make test-fast, while a plain uv run pytest stays serial. Each worker starts its own MiniStack, which the existing unique resource names and per-test table prefixes already allow. CI also prints the 15 slowest tests, and the emulator fixture now waits for MiniStack after killing it so no ResourceWarning is left behind. AGENTS.md and the two skills describe the new commands and the rule that tests must not depend on each other or on tight wall-clock bounds.

Parallel runs everywhere. The macOS and Windows jobs also run with -n auto, which spawns worker processes; the description asks maintainers to confirm this, and it also has a CI_RESULT placeholder where the CI timings should be.

fctl review's first look at d24f525 Β· 8 files, +44 βˆ’11 Β· Review agent settings

CI's pytest steps, make test and make test-fast run with -n auto --dist worksteal (one worker per CPU, each with its own MiniStack); a plain uv run pytest stays serial for debugging. CI also prints the 15 slowest tests. The emulator fixture now waits for MiniStack after killing it.

Co-authored-by: Carl Oscar Aaro <hello@carloscar.com>
@kalaspuff
kalaspuff merged commit 6484dda into main Nov 1, 2026
22 checks passed
@kalaspuff
kalaspuff deleted the fctl/332-run-the-python-tests-in-parallel-if-poss branch November 1, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant