Skip to content

Commit c158f58

Browse files
rustyconoverclaude
andcommitted
pytest: distribute with xdist worksteal
xdist's default 'load' mode hands each worker a contiguous slice of the collection up front. tests/catalog/test_integration.py has 30 tests that each start a fresh catalog worker process (~0.7 s apiece); they all landed on one xdist worker, which ran for 20 s after the other 15 had finished, so the suite took 27 s. With worksteal, idle workers take queued tests from busy ones: 14.8 s. The option is ignored without -n. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ce3433e commit c158f58

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎pyproject.toml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,12 @@ warn_unused_ignores = false
223223
python-version = "3.13"
224224

225225
[tool.pytest.ini_options]
226-
addopts = "--ruff"
226+
# worksteal: xdist's default "load" hands each worker a contiguous slice of the
227+
# collection up front, so tests/catalog/test_integration.py (30 tests that each
228+
# start a fresh catalog worker process, ~0.7 s apiece) all landed on one xdist
229+
# worker, which then ran for 20 s after the rest had finished. worksteal lets
230+
# idle workers take queued tests from busy ones. Ignored without -n.
231+
addopts = "--ruff --dist worksteal"
227232
testpaths = ["tests"]
228233

229234
[tool.coverage.run]

0 commit comments

Comments
 (0)