diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index cfa02d9472e..6f4e35d8499 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -127,15 +127,51 @@ jobs: run: | python -m pip install ^ pytest ^ + pytest-randomly ^ pytest-timeout shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - - name: Run pytest with a single worker + - name: Run pytest with a single worker I + continue-on-error: true 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 ^ + --maxfail=10 ^ + -k "not testsuite" + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - name: Run pytest with a single worker II + continue-on-error: true + 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 ^ + --maxfail=10 ^ + -k "not testsuite" + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - name: Run pytest with a single worker III + continue-on-error: true + 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 ^ + --maxfail=10 ^ + -k "not testsuite" + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - name: Run pytest with a single worker IV + continue-on-error: true + 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 ^ + --maxfail=10 ^ -k "not testsuite" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with a single worker (for gunittest-based tests) diff --git a/python/grass/script/setup.py b/python/grass/script/setup.py index 8baf3cc7956..2010d682379 100644 --- a/python/grass/script/setup.py +++ b/python/grass/script/setup.py @@ -236,6 +236,23 @@ def setup_runtime_env(gisbase=None, *, env=None): ) set_python_path_variable(install_path=gisbase, env=env) set_path_to_python_executable(env=env) + if sys.platform.startswith("win32"): + # pylint: disable=import-outside-toplevel + from .core import start_command, PIPE, create_environment + from .utils import try_remove + + # On Windows, first call to an executable fails, but the following ones work. + # Let's do the first call here and ignore the result. + # While g.message does not theoretically need a project, g.gisenv is called for + # debug level which is stored in gisrc. + gisrc, full_env = create_environment( + "test_db", "test_project", "test_mapset", env=env + ) + process = start_command( + "g.message", message="test", stdout=PIPE, stderr=PIPE, env=full_env + ) + unused_stdout, unused_stderr = process.communicate() + try_remove(gisrc) def runtime_env_is_active(env=None):