From d62ab8afc594ce4d7b9631f6b1ae640ded50b268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:44:31 +0000 Subject: [PATCH 01/21] CI(OSGeo4W): Collect code coverage on pytest tests --- .github/workflows/osgeo4w.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 027cecebf21..4e91bf26969 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -73,6 +73,7 @@ jobs: python3-pip python3-ply python3-pytest + python3-pytest-cov python3-pywin32 python3-wxpython regex-devel @@ -112,8 +113,35 @@ jobs: path %GISBASE%\lib;%GISBASE%\bin;%PATH% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ + --cov ^ + --cov-context=test ^ -ra . shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - name: Fix non-standard installed script paths in coverage data + run: | + call %OSGEO4W_ROOT%\opt\grass\etc\env.bat + set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% + path %GISBASE%\lib;%GISBASE%\bin;%PATH% + set INITIAL_GISBASE=%GISBASE% + export INITIAL_PWD=%CD% + python utils/coverage_mapper.py + coverage combine + coverage html + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + with: + verbose: true + flags: pytest-osgeo4w + name: pytest-osgeo4w + token: ${{ secrets.CODECOV_TOKEN }} + - name: Make python-only code coverage test report available + if: ${{ !cancelled() }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: python-codecoverage-report-${{ matrix.os }} + path: coverage_html_report + retention-days: 1 - name: Run tests run: .github/workflows/test_thorough.bat 'C:\OSGeo4W\opt\grass\grass85.bat' 'C:\OSGeo4W\bin\python3' From 3f91c245dd0d26225243b5d19f976c7723faa8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Tue, 24 Sep 2024 00:22:29 +0000 Subject: [PATCH 02/21] CI(OSGeo4W): Coverage report and json for uploading --- .github/workflows/osgeo4w.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 4e91bf26969..85079b2de82 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -127,6 +127,8 @@ jobs: python utils/coverage_mapper.py coverage combine coverage html + coverage report + coverage json shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Upload coverage reports to Codecov uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 From 2217d908c1f336a9f5d9d1bca375f10a57054b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Tue, 24 Sep 2024 00:23:50 +0000 Subject: [PATCH 03/21] CI(OSGeo4W): Install pytest-cov from pip to have a newer version of coverage --- .github/workflows/osgeo4w.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 85079b2de82..86a04ee3cd6 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -73,7 +73,6 @@ jobs: python3-pip python3-ply python3-pytest - python3-pytest-cov python3-pywin32 python3-wxpython regex-devel @@ -104,7 +103,7 @@ jobs: run: .github/workflows/test_simple.sh - name: Install pytest plugins - run: python -m pip install pytest-timeout + run: python -m pip install --upgrade pytest-timeout pytest-cov shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with a single worker run: | From 6bd8188f504db82bb3eb48e09f52e2f7c057abd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Tue, 24 Sep 2024 01:44:17 +0000 Subject: [PATCH 04/21] CI(OSGeo4W): Set INITIAL_GISBASE and INITIAL_PWD env vars for coverage configuration --- .github/workflows/osgeo4w.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 86a04ee3cd6..9a0d2c2fcba 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -110,6 +110,8 @@ jobs: call %OSGEO4W_ROOT%\opt\grass\etc\env.bat set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% path %GISBASE%\lib;%GISBASE%\bin;%PATH% + set INITIAL_GISBASE=%GISBASE% + set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ --cov ^ @@ -122,7 +124,7 @@ jobs: set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% path %GISBASE%\lib;%GISBASE%\bin;%PATH% set INITIAL_GISBASE=%GISBASE% - export INITIAL_PWD=%CD% + set INITIAL_PWD=%CD% python utils/coverage_mapper.py coverage combine coverage html From 14792e29bf7bce6ac7788650b7d5ad93d5784b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:05:56 +0000 Subject: [PATCH 05/21] utils: Handle paths that already have a .py extension in coverage_mapper --- utils/coverage_mapper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/coverage_mapper.py b/utils/coverage_mapper.py index 9a2f1389781..88fa30f9b54 100644 --- a/utils/coverage_mapper.py +++ b/utils/coverage_mapper.py @@ -22,12 +22,14 @@ def map_scripts_paths(old_path): if INITIAL_GISBASE is None or INITIAL_PWD is None: return old_path p = Path(old_path) + extension = ".py" + p_name = p.stem if p.suffix == extension else p.name temporal_base = Path(INITIAL_GISBASE) / "scripts" / "t.*" base = Path(INITIAL_GISBASE) / "scripts" / "*" if p.match(str(temporal_base)): - return str(Path(INITIAL_PWD) / "temporal" / (p.name) / (p.name)) + ".py" + return str(Path(INITIAL_PWD) / "temporal" / (p_name) / (p_name)) + extension if p.match(str(base)): - return str(Path(INITIAL_PWD) / "scripts" / (p.name) / (p.name)) + ".py" + return str(Path(INITIAL_PWD) / "scripts" / (p_name) / (p_name)) + extension return old_path From fe970fe299d4ba40e361ea6628d38fbf0132dcf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:27:24 +0000 Subject: [PATCH 06/21] CI(OSGeo4W): Run pytest with multiple workers in parallel with coverage --- .github/workflows/osgeo4w.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index b9d13d2df66..25144a6f0a1 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -103,9 +103,9 @@ jobs: run: .github/workflows/test_simple.sh - name: Install pytest plugins - run: python -m pip install --upgrade pytest-timeout pytest-cov + run: python -m pip install --upgrade pytest-timeout pytest-cov pytest-xdist 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 multiple workers in parallel run: | call %OSGEO4W_ROOT%\opt\grass\etc\env.bat set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% @@ -116,6 +116,23 @@ jobs: --durations=0 --durations-min=0.5 ^ --cov ^ --cov-context=test ^ + --numprocesses auto ^ + -m 'not needs_solo_run' ^ + -ra . + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + - 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% + set INITIAL_GISBASE=%GISBASE% + set INITIAL_PWD=%CD% + pytest --verbose --color=yes ^ + --durations=0 --durations-min=0.5 ^ + --cov ^ + --cov-context=test ^ + --cov-append ^ + -m 'needs_solo_run' ^ -ra . shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Fix non-standard installed script paths in coverage data From faf35cdd62550156ac76c5593fe6a5f80d8ca0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:54:05 +0000 Subject: [PATCH 07/21] CI(OSGeo4W): Upgrade pytest --- .github/workflows/osgeo4w.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 25144a6f0a1..3da130b38d8 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -103,7 +103,7 @@ jobs: run: .github/workflows/test_simple.sh - name: Install pytest plugins - run: python -m pip install --upgrade pytest-timeout pytest-cov pytest-xdist + run: python -m pip install --upgrade pytest pytest-timeout pytest-cov pytest-xdist shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with multiple workers in parallel run: | From dc0771a0542bd6480d932ea0e597935f9f572c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:15:04 +0000 Subject: [PATCH 08/21] Remove coverage on xdist run --- .github/workflows/osgeo4w.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 3da130b38d8..cac1f0c773a 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -114,8 +114,6 @@ jobs: set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ - --cov ^ - --cov-context=test ^ --numprocesses auto ^ -m 'not needs_solo_run' ^ -ra . From 82bf493c6045ed862be6add06e594ca47e608609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:24:56 +0000 Subject: [PATCH 09/21] Coverage: Omit gui/wxpython subfolders for now They are not covered at all and take some noticeable time to collect --- .coveragerc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.coveragerc b/.coveragerc index 65e13c2234b..d6c910a628a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -9,6 +9,8 @@ omit = ${INITIAL_PWD-.}/.github/* ${INITIAL_PWD-.}/bin.*/* ${INITIAL_PWD-.}/dist.*/* + ${INITIAL_PWD-.}/gui/wxpython/*/** + **/gui/wxpython/*/** **/OBJ.*/* source = . From b8c4b2f283485a8aa355bdd182cb0c09f54ac1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:37:53 +0000 Subject: [PATCH 10/21] CI(OSGeo4W): Run pytest with multiple workers after single worker run --- .github/workflows/osgeo4w.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index cac1f0c773a..bd8186e193f 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -105,7 +105,7 @@ jobs: - name: Install pytest plugins run: python -m pip install --upgrade pytest pytest-timeout pytest-cov pytest-xdist shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - - name: Run pytest with multiple workers in parallel + - 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% @@ -114,11 +114,13 @@ jobs: set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ - --numprocesses auto ^ - -m 'not needs_solo_run' ^ + --cov ^ + --cov-context=test ^ + --cov-append ^ + -m 'needs_solo_run' ^ -ra . shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - - name: Run pytest with a single worker (for tests marked with needs_solo_run) + - name: Run pytest with multiple workers in parallel run: | call %OSGEO4W_ROOT%\opt\grass\etc\env.bat set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% @@ -127,10 +129,8 @@ jobs: set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ - --cov ^ - --cov-context=test ^ - --cov-append ^ - -m 'needs_solo_run' ^ + --numprocesses auto ^ + -m 'not needs_solo_run' ^ -ra . shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Fix non-standard installed script paths in coverage data From f1a8ca6115c2c9d3bc435d190c654fea0c31524e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:59:39 +0000 Subject: [PATCH 11/21] CI(OSGeo4W): Move marker filter after defining the root folder --- .github/workflows/osgeo4w.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index bd8186e193f..c29fa0a27d4 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -117,8 +117,8 @@ jobs: --cov ^ --cov-context=test ^ --cov-append ^ - -m 'needs_solo_run' ^ - -ra . + -ra . ^ + -m 'needs_solo_run' shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with multiple workers in parallel run: | @@ -130,8 +130,8 @@ jobs: pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ --numprocesses auto ^ - -m 'not needs_solo_run' ^ - -ra . + -ra . ^ + -m 'not needs_solo_run' shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Fix non-standard installed script paths in coverage data run: | From ded3bd420de729653d643fd9186650500f2c5cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:00:27 +0000 Subject: [PATCH 12/21] CI(OSGeo4W): Use double quote for marker filter --- .github/workflows/osgeo4w.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index c29fa0a27d4..b630e8b302d 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -131,7 +131,7 @@ jobs: --durations=0 --durations-min=0.5 ^ --numprocesses auto ^ -ra . ^ - -m 'not needs_solo_run' + -m "not needs_solo_run" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Fix non-standard installed script paths in coverage data run: | From 700a3a567701d133f293f46616b40ed9125a6350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:22:04 +0000 Subject: [PATCH 13/21] CI(OSGeo4W): Use double quote for marker filter --- .github/workflows/osgeo4w.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index b630e8b302d..42653810586 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -118,7 +118,7 @@ jobs: --cov-context=test ^ --cov-append ^ -ra . ^ - -m 'needs_solo_run' + -m "needs_solo_run" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with multiple workers in parallel run: | From 57f7b00ce7e88b55145ec6651ed7d05400c3f5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:44:18 +0000 Subject: [PATCH 14/21] CI(OSGeo4W): Run pytest with multiple workers before single worker run --- .github/workflows/osgeo4w.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 42653810586..6ae7dc18393 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -105,7 +105,7 @@ jobs: - name: Install pytest plugins run: python -m pip install --upgrade pytest pytest-timeout pytest-cov pytest-xdist shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - - name: Run pytest with a single worker (for tests marked with needs_solo_run) + - name: Run pytest with multiple workers in parallel run: | call %OSGEO4W_ROOT%\opt\grass\etc\env.bat set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% @@ -114,13 +114,11 @@ jobs: set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ - --cov ^ - --cov-context=test ^ - --cov-append ^ + --numprocesses auto ^ -ra . ^ - -m "needs_solo_run" + -m "not needs_solo_run" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - - name: Run pytest with multiple workers in parallel + - 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% @@ -129,9 +127,11 @@ jobs: set INITIAL_PWD=%CD% pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ - --numprocesses auto ^ + --cov ^ + --cov-context=test ^ + --cov-append ^ -ra . ^ - -m "not needs_solo_run" + -m "needs_solo_run" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Fix non-standard installed script paths in coverage data run: | From 46dd0e304473120a0345acab3ddc3fbaf70f3fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:46:14 +0000 Subject: [PATCH 15/21] CI(OSGeo4W): Add back coverage to pytest with multiple workers --- .github/workflows/osgeo4w.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 6ae7dc18393..3b3689a497d 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -115,6 +115,8 @@ jobs: pytest --verbose --color=yes ^ --durations=0 --durations-min=0.5 ^ --numprocesses auto ^ + --cov ^ + --cov-context=test ^ -ra . ^ -m "not needs_solo_run" shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" From 21f215a8975b05e4292dfed7ec0d08dda806622a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 16:41:14 +0000 Subject: [PATCH 16/21] g.version: Remove scope of session fixture to return a new instance for each test --- general/g.version/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/general/g.version/tests/conftest.py b/general/g.version/tests/conftest.py index e4357b2f672..640cf085f1a 100644 --- a/general/g.version/tests/conftest.py +++ b/general/g.version/tests/conftest.py @@ -3,7 +3,7 @@ import grass.script as gs -@pytest.fixture(scope="module") +@pytest.fixture def session(tmp_path_factory): """Set up a GRASS session for the tests.""" tmp_path = tmp_path_factory.mktemp("grass_session") From cecdd53580e9e5fb622c1e8f0d0df61c8e3e1152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:13:26 +0000 Subject: [PATCH 17/21] grass.script.core: Try to copy env in create_project --- python/grass/script/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/grass/script/core.py b/python/grass/script/core.py index ee90a41d4ef..d02d24706a3 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -1769,7 +1769,7 @@ def create_project( # Lazy-importing to avoid circular dependencies. # pylint: disable=import-outside-toplevel if os.environ.get("GISBASE"): - env = os.environ + env = os.environ.copy() else: from grass.script.setup import setup_runtime_env From 12d74bf1f915788d39511b6b8f851c7217a025cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:18:05 +0000 Subject: [PATCH 18/21] g.version: Delete GISBASE env var before calling gs.create_project --- general/g.version/tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/general/g.version/tests/conftest.py b/general/g.version/tests/conftest.py index 640cf085f1a..9ed72d55038 100644 --- a/general/g.version/tests/conftest.py +++ b/general/g.version/tests/conftest.py @@ -4,10 +4,11 @@ @pytest.fixture -def session(tmp_path_factory): +def session(tmp_path_factory, monkeypatch): """Set up a GRASS session for the tests.""" tmp_path = tmp_path_factory.mktemp("grass_session") project = "test_project" + monkeypatch.delenv("GISBASE", raising=False) # Create a test location gs.create_project(tmp_path, project) From ab87999c5d4054a85dff989c1878cfffdb86e9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:53:38 +0000 Subject: [PATCH 19/21] Revert "grass.script.core: Try to copy env in create_project" --- python/grass/script/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/grass/script/core.py b/python/grass/script/core.py index d02d24706a3..ee90a41d4ef 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -1769,7 +1769,7 @@ def create_project( # Lazy-importing to avoid circular dependencies. # pylint: disable=import-outside-toplevel if os.environ.get("GISBASE"): - env = os.environ.copy() + env = os.environ else: from grass.script.setup import setup_runtime_env From f689823fbbd56cd69673b1487d313daafc1849a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 6 Oct 2024 11:17:43 +0000 Subject: [PATCH 20/21] CI(OSGeo4W): Randomize pytest tests --- .github/workflows/osgeo4w.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 3b3689a497d..460f9d1be6b 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -103,7 +103,7 @@ jobs: run: .github/workflows/test_simple.sh - name: Install pytest plugins - run: python -m pip install --upgrade pytest pytest-timeout pytest-cov pytest-xdist + run: python -m pip install --upgrade pytest pytest-timeout pytest-cov pytest-xdist pytest-randomly shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" - name: Run pytest with multiple workers in parallel run: | From a4ac77b06cfe1b1d3792c4fbca7db9e986bce1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 12 Sep 2026 17:19:13 -0400 Subject: [PATCH 21/21] CI(OSGeo4W): Add zizmor misfeature suppression to coverage fixup step The new coverage combine/report step introduced during the merge from main was missing the same zizmor ignore comment used by the other Windows CMD-shell steps in this workflow, causing the "Additional checks" lint job to fail. --- .github/workflows/osgeo4w.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index e8f4f2f4178..44fcd4f5803 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -193,7 +193,8 @@ jobs: coverage html coverage report coverage json - shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" + # 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: Upload test results to Codecov if: ${{ !cancelled() }}