X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/52b76d1d0164149446c497121225aa3bf36f1148..0fb8eade136ea03e7853aca0795ca69833c33661:/test/python/test_tools_exec_utils.py?ds=sidebyside diff --git a/test/python/test_tools_exec_utils.py b/test/python/test_tools_exec_utils.py index d9f80740..25ccf163 100644 --- a/test/python/test_tools_exec_utils.py +++ b/test/python/test_tools_exec_utils.py @@ -3,100 +3,107 @@ Tests for tools.exec_utils module. """ from pathlib import Path import subprocess -import tempfile import pytest -from nominatim.config import Configuration import nominatim.tools.exec_utils as exec_utils -@pytest.fixture -def tmp_phplib_dir(): - with tempfile.TemporaryDirectory() as phpdir: - (Path(phpdir) / 'admin').mkdir() +class TestRunLegacyScript: - yield Path(phpdir) + @pytest.fixture(autouse=True) + def setup_nominatim_env(self, tmp_path, def_config): + tmp_phplib_dir = tmp_path / 'phplib' + tmp_phplib_dir.mkdir() + (tmp_phplib_dir / 'admin').mkdir() -@pytest.fixture -def nominatim_env(tmp_phplib_dir): - class _NominatimEnv: - config = Configuration(None, Path(__file__) / '..' / '..' / '..' / 'settings') - phplib_dir = tmp_phplib_dir - data_dir = Path('data') - project_dir = Path('.') - module_dir = 'module' - osm2pgsql_path = 'osm2pgsql' + class _NominatimEnv: + config = def_config + phplib_dir = tmp_phplib_dir + data_dir = Path('data') + project_dir = Path('.') + sqllib_dir = Path('lib-sql') + config_dir = Path('settings') + module_dir = 'module' + osm2pgsql_path = 'osm2pgsql' - return _NominatimEnv + self.testenv = _NominatimEnv -@pytest.fixture -def test_script(nominatim_env): - def _create_file(code): - with (nominatim_env.phplib_dir / 'admin' / 't.php').open(mode='w') as fd: - fd.write('