Repository navigation
Conversation
Windows CI ran pytest single-worker with a fixed test order, unlike Linux CI's pytest-xdist + needs_solo_run split. Under a fixed order, whichever test happens to run first in a given worker never changes, so an order-dependent bug that only breaks the first call to a C-based GRASS tool/library in a fresh worker process can stay hidden indefinitely. Install pytest-xdist and pytest-randomly and mirror Linux CI's parallel / needs_solo_run split so this class of bug surfaces instead of hiding. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Description
Windows CI runs the pytest suite with a single worker and always in the same
order. Install
pytest-xdistandpytest-randomlyand mirror the parallel /needs_solo_runsplit thatpytest.ymlalready uses on Linux.Motivation and context
xdist workers are long-lived processes which handle several test files each,
so state left behind by one test can affect a later one running in the same
worker. With a single worker and a fixed order, whichever test runs first
never changes, so a failure which depends on the order has no way to show up.
Randomizing the order is what makes that kind of failure surface.
Linux CI does not use
pytest-randomlyyet; it can be added there in aseparate step if this turns out to be useful.
How has this been tested?
Windows CI on this branch, and about 30 runs of the randomized job while
looking for an order-dependent failure on Windows. The results were identical
in all of them (the same pre-existing failures, none of them related to the
order), so the randomization does not add noise to the job.
Windows CI timing: xdist vs. single worker
Compared Windows CI (
osgeo4w.yml) job data with pytest-xdist enabled (55job records from 13 runs across this investigation's branches) against
single-worker pytest (118 job records spanning 11 months of
mainhistory,2025-07-25 to 2026-06-21).
pytest step timing. xdist splits the old single step into two — a
parallel step plus a new
needs_solo_runserial step, each paying its owntest-collection overhead — compared here against the combined total:
main, before)* GitHub's job-log/step retention (roughly 3-4 months) limits step-level
"before" data to the 5 most recent
mainruns; treat as indicative, notdefinitive.
** Only the 8 full-scope, PR-triggered jobs ran both steps; 45
workflow_dispatchfishing-attempt jobs used earlier in this investigationintentionally skipped the solo/gunittest/thorough steps to isolate the
parallel step, so they only contribute to the parallel-step-alone row.
Net: the pytest step is about 20% faster with xdist, even after paying for
a second collection pass.
Whole-job duration (compile + all test steps; not expected to move,
since pytest is a small slice of it):
main, before)No meaningful difference — the job is dominated by MSYS2 setup, compiling
GRASS, and the (unchanged) single-worker gunittest thorough-test step.
Timeouts / hangs. 0 GitHub Actions
timed_outconclusions in eithergroup (0/53 xdist, 0/118 single-worker). A handful of
cancelledjobs inboth groups (3/55 xdist, 4/118 single-worker) were checked individually and
are routine
cancel-in-progresssupersession from newer pushes to the samebranch, not hangs or timeouts.
Written with the help of Claude Code, under my review.