Skip to content

Commit

Permalink
CI(OSGeo4W): Run pytest tests on Windows (#4366)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix authored Sep 23, 2024
1 parent bd39db7 commit 6325a18
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ jobs:
pdal-devel
pdcurses
proj-devel
python3-core
python3-jupyter
python3-matplotlib
python3-numpy
python3-pip
python3-ply
python3-pytest
python3-pywin32
python3-wxpython
regex-devel
Expand Down Expand Up @@ -98,6 +102,19 @@ jobs:
shell: msys2 {0}
run: .github/workflows/test_simple.sh

- name: Install pytest plugins
run: python -m pip install pytest-timeout
shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}""
- name: Run pytest with a single worker
run: |
call %OSGEO4W_ROOT%\opt\grass\etc\env.bat
set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
path %GISBASE%\lib;%GISBASE%\bin;%PATH%
pytest --verbose --color=yes ^
--durations=0 --durations-min=0.5 ^
-ra .
shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}""

- name: Run tests
run: .github/workflows/test_thorough.bat 'C:\OSGeo4W\opt\grass\grass85.bat' 'C:\OSGeo4W\bin\python3'

Expand Down
9 changes: 9 additions & 0 deletions general/g.mapsets/tests/g_mapsets_list_format_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Test parsing and structure of CSV and JSON outputs from g.mapsets"""

import json
import sys
import pytest
import grass.script as gs
from grass.script import utils as gutils
Expand All @@ -30,6 +31,10 @@ def _check_parsed_list(mapsets, text, sep="|"):
assert text == sep.join(mapsets) + "\n"


@pytest.mark.xfail(
sys.platform == "win32",
reason="universal_newlines or text subprocess option not used",
)
@pytest.mark.parametrize("separator", SEPARATORS)
def test_plain_list_output(simple_dataset, separator):
"""Test that the separators are properly applied with list flag"""
Expand All @@ -38,6 +43,10 @@ def test_plain_list_output(simple_dataset, separator):
_check_parsed_list(mapsets, text, gutils.separator(separator))


@pytest.mark.xfail(
sys.platform == "win32",
reason="universal_newlines or text subprocess option not used",
)
@pytest.mark.parametrize("separator", SEPARATORS)
def test_plain_print_output(simple_dataset, separator):
"""Test that the separators are properly applied with print flag"""
Expand Down
10 changes: 10 additions & 0 deletions python/grass/jupyter/tests/grass_jupyter_session_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
import sys

import pytest


# All init tests change the global environment, but we use a separate process
# only when it is necessary.
Expand All @@ -20,6 +22,10 @@ def run_in_subprocess(file):
return process.stdout


@pytest.mark.xfail(
sys.platform == "win32",
reason="tmp_path string in interpolated code should be escaped or use raw strings",
)
def test_init_finish(tmp_path):
"""Check that init function works with an explicit session finish"""
location = "test"
Expand All @@ -42,6 +48,10 @@ def test_init_finish(tmp_path):
assert not os.path.exists(session_file), f"Session file {session_file} not deleted"


@pytest.mark.xfail(
sys.platform == "win32",
reason="tmp_path string in interpolated code should be escaped or use raw strings",
)
def test_init_with_auto_finish(tmp_path):
"""Check that init function works with an implicit session finish"""
location = "test"
Expand Down
5 changes: 5 additions & 0 deletions python/grass/jupyter/tests/timeseriesmap_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test TimeSeriesMap functions"""

from pathlib import Path
import sys

import pytest

Expand Down Expand Up @@ -66,6 +67,10 @@ def test_render_layers(space_time_raster_dataset, fill_gaps):
assert Path(filename).is_file()


@pytest.mark.xfail(
sys.platform == "win32",
reason="DejaVuSans.ttf file isn't found and not installed with GRASS",
)
@pytest.mark.needs_solo_run
def test_save(space_time_raster_dataset, tmp_path):
"""Test returns from animate and time_slider are correct object types"""
Expand Down

0 comments on commit 6325a18

Please sign in to comment.