test: enable pytest-xdist parallel execution#11
Open
GrigoryEvko wants to merge 1 commit into
Open
Conversation
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.
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.
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
-n0on the command line; the default isauto, which picks one worker per CPU.The change adds
pytest-xdist>=3.6to thetestextras inpyproject.tomland updatespytest.iniaddopts to include-n auto --dist=loadgroup. Theloadgroupdist mode honors thexdist_groupmarker so any test family that needs to share a worker (Redis fixture state, shared module-scope fixtures) can opt in without disabling parallelism globally; anxdist_groupmarker entry is added to themarkerstable so pytest does not warn on unknown markers when groups are applied. No production code changes.Smoke verification on a branch combining current
mainwith 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 ontests/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; thetests/evolution/test_steady_state_benchmark.py::TestScalingfamily runs an actual MAP-Elites loop and takes around eight seconds. Both are pre-existing and on the maintainer's territory.