Skip to content

grass.script.setup: Run the presumably failing first call internally #5914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions python/grass/script/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading