fail if osm2pgsql is not recent enough

This commit is contained in:
Sarah Hoffmann
2024-08-09 14:44:49 +02:00
parent 3cc20581ae
commit 6527b7cdcd
3 changed files with 44 additions and 6 deletions

View File

@@ -7,10 +7,23 @@
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,