implement stage 1 : python unit tests

This commit is contained in:
Sri Charan Chittineni
2026-01-17 10:25:44 +05:30
committed by Sri CHaRan
parent 2197236872
commit abd7c302f8
2 changed files with 31 additions and 3 deletions

View File

@@ -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

View File

@@ -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):