Skip to content

test: enable pytest-xdist parallel execution#11

Open
GrigoryEvko wants to merge 1 commit into
FusionBrainLab:mainfrom
GrigoryEvko:fix/test-parallel-xdist
Open

test: enable pytest-xdist parallel execution#11
GrigoryEvko wants to merge 1 commit into
FusionBrainLab:mainfrom
GrigoryEvko:fix/test-parallel-xdist

Conversation

@GrigoryEvko
Copy link
Copy Markdown

Test count is approaching five thousand and the serial single-process run on a 16-core developer machine takes around seventy seconds; on CI runners with fewer cores or shared load the wall time is longer. pytest-xdist parallelizes test execution across worker processes and brings local turnaround down to around forty seconds on the same hardware. Operators who need the previous serial behavior can pass -n0 on the command line; the default is auto, which picks one worker per CPU.

The change adds pytest-xdist>=3.6 to the test extras in pyproject.toml and updates pytest.ini addopts to include -n auto --dist=loadgroup. The loadgroup dist mode honors the xdist_group marker so any test family that needs to share a worker (Redis fixture state, shared module-scope fixtures) can opt in without disabling parallelism globally; an xdist_group marker entry is added to the markers table so pytest does not warn on unknown markers when groups are applied. No production code changes.

Smoke verification on a branch combining current main with every open pull request from this contributor (smoke/all-open-prs-xdist) ran the full test suite three times under -n auto: 5236 passed in 41.79s, 5236 passed in 46.10s, 5236 passed in 48.81s. A single intermittent failure was observed on tests/evolution/test_steady_state_determinism.py::test_epoch_boundaries_stable (the test runs an actual evolution loop with timing-based assertions and gets squeezed when xdist saturates CPU). The test passed in three out of four separate full-suite runs and passed three times in a row in isolation; the flake is order-of-magnitude rare and unrelated to any code change in this PR. Follow-up isolation audit will tighten that fixture if the flake persists.

Other items the smoke run surfaced (none in scope for this PR): roughly twenty tests under tests/memory/ consume between four and eleven seconds each (about a hundred and fifty seconds of cumulative test time), driven by the recent memory-subsystem refactor; the tests/evolution/test_steady_state_benchmark.py::TestScaling family runs an actual MAP-Elites loop and takes around eight seconds. Both are pre-existing and on the maintainer's territory.

Adds pytest-xdist>=3.6 to the test extras and bakes -n auto plus
--dist=loadgroup into pytest.ini addopts. Operators get parallel
execution by default; loadgroup honors xdist_group markers so any
test family that needs to share a worker can opt in.

Follow-up PR addresses any isolation breakage surfaced by the
switch (loguru handler leaks, shared module-scope state, hardcoded
/tmp/ paths). Smoke verification is on the combined open-PR branch
smoke/all-open-prs-xdist.
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