X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bb175cc95898de420781867973b38d033c187e81..02364ce6c8334b314ea543becbb93381e6c1c1ee:/test/python/tools/conftest.py?ds=sidebyside diff --git a/test/python/tools/conftest.py b/test/python/tools/conftest.py index f72caf37..0098747e 100644 --- a/test/python/tools/conftest.py +++ b/test/python/tools/conftest.py @@ -1,10 +1,29 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2024 by the Nominatim developer community. +# For a full list of authors see the git log. 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,