Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d62ab8a
CI(OSGeo4W): Collect code coverage on pytest tests
echoix Sep 23, 2024
3f91c24
CI(OSGeo4W): Coverage report and json for uploading
echoix Sep 24, 2024
2217d90
CI(OSGeo4W): Install pytest-cov from pip to have a newer version of c…
echoix Sep 24, 2024
6bd8188
CI(OSGeo4W): Set INITIAL_GISBASE and INITIAL_PWD env vars for coverag…
echoix Sep 24, 2024
0bcf522
Merge branch 'main' into windows-pytest-cov
echoix Sep 24, 2024
03947d0
Merge branch 'main' into windows-pytest-cov
echoix Sep 29, 2024
6ba4477
Merge branch 'main' into windows-pytest-cov
echoix Oct 5, 2024
14792e2
utils: Handle paths that already have a .py extension in coverage_mapper
echoix Sep 29, 2024
fe970fe
CI(OSGeo4W): Run pytest with multiple workers in parallel with coverage
echoix Oct 5, 2024
faf35cd
CI(OSGeo4W): Upgrade pytest
echoix Oct 5, 2024
dc0771a
Remove coverage on xdist run
echoix Oct 5, 2024
82bf493
Coverage: Omit gui/wxpython subfolders for now
echoix Oct 5, 2024
b8c4b2f
CI(OSGeo4W): Run pytest with multiple workers after single worker run
echoix Oct 5, 2024
f1a8ca6
CI(OSGeo4W): Move marker filter after defining the root folder
echoix Oct 5, 2024
ded3bd4
CI(OSGeo4W): Use double quote for marker filter
echoix Oct 5, 2024
700a3a5
CI(OSGeo4W): Use double quote for marker filter
echoix Oct 5, 2024
57f7b00
CI(OSGeo4W): Run pytest with multiple workers before single worker run
echoix Oct 5, 2024
46dd0e3
CI(OSGeo4W): Add back coverage to pytest with multiple workers
echoix Oct 5, 2024
21f215a
g.version: Remove scope of session fixture to return a new instance f…
echoix Oct 5, 2024
cecdd53
grass.script.core: Try to copy env in create_project
echoix Oct 5, 2024
12d74bf
g.version: Delete GISBASE env var before calling gs.create_project
echoix Oct 5, 2024
ab87999
Revert "grass.script.core: Try to copy env in create_project"
echoix Oct 5, 2024
f689823
CI(OSGeo4W): Randomize pytest tests
echoix Oct 6, 2024
5f4ea95
Merge remote-tracking branch 'upstream/main' into windows-pytest-cov
echoix Sep 12, 2026
a4ac77b
CI(OSGeo4W): Add zizmor misfeature suppression to coverage fixup step
echoix Sep 12, 2026
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: 38 additions & 0 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
python -m pip install ^
pytest ^
pytest-timeout ^
pytest-cov ^
pytest-xdist ^
pytest-randomly
# Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis
Expand All @@ -138,8 +139,11 @@ 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 ^
@.github/workflows/pytest_args_ci.txt ^
@.github/workflows/pytest_args_cov.txt ^
@.github/workflows/pytest_args_parallel.txt ^
--junitxml=pytest.xdist.junit.xml ^
-k "not testsuite"
Expand All @@ -152,8 +156,11 @@ 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 ^
@.github/workflows/pytest_args_ci.txt ^
@.github/workflows/pytest_args_cov.txt ^
@.github/workflows/pytest_args_not_parallel.txt ^
--junitxml=pytest.needs_solo_run.junit.xml ^
-k "not testsuite"
Expand All @@ -164,13 +171,30 @@ jobs:
call %OSGEO4W_ROOT%\opt\grass\etc\env.bat
set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
path %GISBASE%\lib;%GISBASE%\bin;%PATH%;%OSGEO4W_ROOT%\opt\grass
set INITIAL_GISBASE=%GISBASE%
set INITIAL_PWD=%CD%
pytest ^
@.github/workflows/pytest_args_ci.txt ^
@.github/workflows/pytest_args_cov.txt ^
@.github/workflows/pytest_args_deselect.txt ^
@.github/workflows/pytest_args_gunittest.txt ^
--junitxml=pytest.gunittest.junit.xml
# 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: 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%
set INITIAL_PWD=%CD%
python utils/coverage_mapper.py
coverage combine
coverage html
coverage report
coverage json
# 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() }}
Expand All @@ -180,6 +204,20 @@ jobs:
flags: ${{ matrix.os }}-pytest-python
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-codecoverage-report-${{ matrix.os }}
path: coverage_html_report
retention-days: 1

- name: Run tests
run: .github/workflows/test_thorough.bat '%O4WROOT%\opt\grass\grass86.bat' '%O4WROOT%\bin\python3'
Expand Down
5 changes: 3 additions & 2 deletions general/g.version/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import grass.script as gs


@pytest.fixture(scope="module")
def session(tmp_path_factory):
@pytest.fixture
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)
Expand Down
Loading