From 0c2108f1cc7b384fa041afd13e764bd149c04347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Fri, 4 Sep 2026 09:42:08 +0000 Subject: [PATCH] CI: Run Windows pytest suite with xdist and randomized order 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 --- .github/workflows/osgeo4w.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 1d93df3fae7..96b5a6bb9aa 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -128,17 +128,34 @@ jobs: run: | python -m pip install ^ pytest ^ - pytest-timeout + pytest-timeout ^ + pytest-xdist ^ + pytest-randomly # Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" # zizmor: ignore[misfeature] - - name: Run pytest with a single worker + - name: Run pytest with multiple workers in parallel run: | call %OSGEO4W_ROOT%\opt\grass\etc\env.bat set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% path %GISBASE%\lib;%GISBASE%\bin;%PATH% pytest ^ @.github/workflows/pytest_args_ci.txt ^ - --junitxml=pytest.junit.xml ^ + @.github/workflows/pytest_args_parallel.txt ^ + --junitxml=pytest.xdist.junit.xml ^ + -k "not testsuite" + env: + OMP_NUM_THREADS: 1 + # Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" # zizmor: ignore[misfeature] + - name: Run pytest with a single worker (for tests marked with needs_solo_run) + run: | + call %OSGEO4W_ROOT%\opt\grass\etc\env.bat + set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% + path %GISBASE%\lib;%GISBASE%\bin;%PATH% + pytest ^ + @.github/workflows/pytest_args_ci.txt ^ + @.github/workflows/pytest_args_not_parallel.txt ^ + --junitxml=pytest.needs_solo_run.junit.xml ^ -k "not testsuite" # Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" # zizmor: ignore[misfeature]