]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/tools/conftest.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / test / python / tools / conftest.py
index 60b25c3b46944fa7e100b0d78836616b7eafcc5b..0098747e52537d97eb33c889fcbb0f600fb2967e 100644 (file)
@@ -7,10 +7,23 @@
 import pytest
 
 @pytest.fixture
 import pytest
 
 @pytest.fixture
-def osm2pgsql_options(temp_db):
-    """ A standard set of options for osm2pgsql.
+def osm2pgsql_options(temp_db, tmp_path):
+    """ A standard set of options for osm2pgsql
+        together with a osm2pgsql mock that just reflects the command line.
     """
     """
-    return dict(osm2pgsql='echo',
+    osm2pgsql_exec = tmp_path / 'osm2pgsql_mock'
+
+    osm2pgsql_exec.write_text("""#!/bin/sh
+
+if [ "$*" = "--version" ]; then
+  >&2 echo "2024-08-09 11:16:23  osm2pgsql version 11.7.2 (11.7.2)"
+else
+  echo "$@"
+fi
+    """)
+    osm2pgsql_exec.chmod(0o777)
+
+    return dict(osm2pgsql=str(osm2pgsql_exec),
                 osm2pgsql_cache=10,
                 osm2pgsql_style='style.file',
                 threads=1,
                 osm2pgsql_cache=10,
                 osm2pgsql_style='style.file',
                 threads=1,