]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_tools_exec_utils.py
Errors fixes, Cleaning code, Improvement and addition of tests
[nominatim.git] / test / python / test_tools_exec_utils.py
index ef1b46e286b9d9b7ac9383751c017a575a0b7dc4..3abe98181232cfbb1a45e98e20e0d57175defb56 100644 (file)
@@ -9,13 +9,6 @@ import pytest
 
 import nominatim.tools.exec_utils as exec_utils
 
-@pytest.fixture
-def tmp_phplib_dir():
-    with tempfile.TemporaryDirectory() as phpdir:
-        (Path(phpdir) / 'admin').mkdir()
-
-        yield Path(phpdir)
-
 @pytest.fixture
 def nominatim_env(tmp_phplib_dir, def_config):
     class _NominatimEnv:
@@ -23,6 +16,8 @@ def nominatim_env(tmp_phplib_dir, 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'
 
@@ -103,8 +98,15 @@ def test_run_api_with_extra_env(tmp_project_dir):
 
 ### run_osm2pgsql
 
-def test_run_osm2pgsql():
-    exec_utils.run_osm2pgsql(dict(osm2pgsql='echo', append=False, flatnode_file=None,
-                                  dsn='dbname=foobar', threads=1, osm2pgsql_cache=500,
-                                  osm2pgsql_style='./my.style',
-                                  import_file='foo.bar'))
+def test_run_osm2pgsql(osm2pgsql_options):
+    osm2pgsql_options['append'] = False
+    osm2pgsql_options['import_file'] = 'foo.bar'
+    osm2pgsql_options['tablespaces']['osm_data'] = 'extra'
+    exec_utils.run_osm2pgsql(osm2pgsql_options)
+
+
+def test_run_osm2pgsql_disable_jit(osm2pgsql_options):
+    osm2pgsql_options['append'] = True
+    osm2pgsql_options['import_file'] = 'foo.bar'
+    osm2pgsql_options['disable_jit'] = True
+    exec_utils.run_osm2pgsql(osm2pgsql_options)