mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
implement stage 1 : python unit tests
This commit is contained in:
committed by
Sri CHaRan
parent
2197236872
commit
abd7c302f8
27
.github/workflows/ci-tests.yml
vendored
27
.github/workflows/ci-tests.yml
vendored
@@ -140,6 +140,33 @@ jobs:
|
|||||||
../venv/bin/python -m pytest test/bdd --nominatim-purge
|
../venv/bin/python -m pytest test/bdd --nominatim-purge
|
||||||
working-directory: Nominatim
|
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:
|
install:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: create-archive
|
needs: create-archive
|
||||||
|
|||||||
@@ -200,14 +200,15 @@ def test_get_path_empty(make_config):
|
|||||||
assert not config.get_path('TOKENIZER_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()
|
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')
|
result = config.get_path('FOOBAR')
|
||||||
|
|
||||||
assert isinstance(result, Path)
|
assert isinstance(result, Path)
|
||||||
assert str(result) == '/dont/care'
|
assert str(result) == str(p)
|
||||||
|
|
||||||
|
|
||||||
def test_get_path_relative(make_config, monkeypatch, tmp_path):
|
def test_get_path_relative(make_config, monkeypatch, tmp_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user