]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_tools_exec_utils.py
use tmp_path fixture in config tests
[nominatim.git] / test / python / test_tools_exec_utils.py
index 26a714f3dc6169a398e64041da70d7b7ec844af5..8f60ac7404e0c05e1d3ebf51e080477f9fb269da 100644 (file)
@@ -23,6 +23,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'
 
@@ -63,8 +65,8 @@ def test_run_legacy_return_dont_throw_on_success(nominatim_env, test_script):
     assert 0 == exec_utils.run_legacy_script(fname, nominatim_env=nominatim_env,
                                              throw_on_fail=True)
 
-def test_run_legacy_use_given__module_path(nominatim_env, test_script):
-    fname = test_script("exit($_SERVER['NOMINATIM_DATABASE_MODULE_PATH'] == 'module' ? 0 : 23);")
+def test_run_legacy_use_given_module_path(nominatim_env, test_script):
+    fname = test_script("exit($_SERVER['NOMINATIM_DATABASE_MODULE_PATH'] == '' ? 0 : 23);")
 
     assert 0 == exec_utils.run_legacy_script(fname, nominatim_env=nominatim_env)
 
@@ -103,8 +105,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)