From abd7c302f8bfe0c6b2bf0a4884ae9ebe29c03bb5 Mon Sep 17 00:00:00 2001 From: Sri Charan Chittineni Date: Sat, 17 Jan 2026 10:25:44 +0530 Subject: [PATCH] implement stage 1 : python unit tests --- .github/workflows/ci-tests.yml | 27 +++++++++++++++++++++++++++ test/python/config/test_config.py | 7 ++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index ff89bfbf..9b6c6b99 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -140,6 +140,33 @@ jobs: ../venv/bin/python -m pytest test/bdd --nominatim-purge working-directory: Nominatim + tests-windows: + needs: create-archive + runs-on: windows-latest + + steps: + - uses: actions/download-artifact@v4 + with: + name: full-source + + - name: Unpack Nominatim + run: tar xf nominatim-src.tar.bz2 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install test prerequisites + run: | + python -m pip install -U pip + python -m pip install pytest pytest-asyncio "psycopg[binary]!=3.3.0" python-dotenv pyyaml jinja2 psutil sqlalchemy + + - name: Python unit tests (Windows subset) + run: | + python -m pytest test/python/utils test/python/config test/python/api/test_api_types.py test/python/api/search/test_query.py test/python/api/query_processing/test_regex_replace.py test/python/api/query_processing/test_split_japanese_phrases.py + working-directory: Nominatim + install: runs-on: ubuntu-latest needs: create-archive diff --git a/test/python/config/test_config.py b/test/python/config/test_config.py index 555bc4e7..4908fd9a 100644 --- a/test/python/config/test_config.py +++ b/test/python/config/test_config.py @@ -200,14 +200,15 @@ def test_get_path_empty(make_config): assert not config.get_path('TOKENIZER_CONFIG') -def test_get_path_absolute(make_config, monkeypatch): +def test_get_path_absolute(make_config, monkeypatch, tmp_path): config = make_config() - monkeypatch.setenv('NOMINATIM_FOOBAR', '/dont/care') + p = (tmp_path / "does_not_exist").resolve() + monkeypatch.setenv('NOMINATIM_FOOBAR', str(p)) result = config.get_path('FOOBAR') assert isinstance(result, Path) - assert str(result) == '/dont/care' + assert str(result) == str(p) def test_get_path_relative(make_config, monkeypatch, tmp_path):