diff --git a/test/bdd/conftest.py b/test/bdd/conftest.py
index 8aec5782..dd119cfa 100644
--- a/test/bdd/conftest.py
+++ b/test/bdd/conftest.py
@@ -123,7 +123,7 @@ def db(template_db, pytestconfig):
@pytest.fixture
-def db_conn(def_config):
+def db_conn(db, def_config):
with psycopg.connect(def_config.get_libpq_dsn()) as conn:
info = psycopg.types.TypeInfo.fetch(conn, "hstore")
psycopg.types.hstore.register_hstore(info, conn)
@@ -313,22 +313,3 @@ def set_node_grid(datatable, step, origin):
raise RuntimeError('Grid origin must be either coordinate or alias.')
return Grid(datatable, step, origin)
-
-
-@when('indexing')
-def do_index(def_config):
- """ Run Nominatim's indexing step.
- """
- cli.nominatim(['index'], def_config.environ)
-
-
-@then(step_parse(r'(?P
\w+) contains(?P exactly)?'))
-def check_place_content(db_conn, datatable, node_grid, table, exact):
- check_table_content(db_conn, table, datatable, grid=node_grid, exact=bool(exact))
-
-
-@then(step_parse('(?Pplacex?) has no entry for '
- r'(?P[NRW])(?P\d+)(?::(?P\S+))?'),
- converters={'osm_id': int})
-def check_place_missing_lines(db_conn, table, osm_type, osm_id, osm_class):
- check_table_has_lines(db_conn, table, osm_type, osm_id, osm_class)
diff --git a/test/bdd/test_osm2pgsql.py b/test/bdd/test_osm2pgsql.py
index 43262519..dccedc4d 100644
--- a/test/bdd/test_osm2pgsql.py
+++ b/test/bdd/test_osm2pgsql.py
@@ -91,4 +91,23 @@ def update_from_osm_file(db_conn, def_config, osm2pgsql_options, opl_writer, doc
run_osm2pgsql_updates(db_conn, osm2pgsql_options)
+@when('indexing')
+def do_index(def_config):
+ """ Run Nominatim's indexing step.
+ """
+ cli.nominatim(['index'], def_config.environ)
+
+
+@then(step_parse(r'(?P\w+) contains(?P exactly)?'))
+def check_place_content(db_conn, datatable, node_grid, table, exact):
+ check_table_content(db_conn, table, datatable, grid=node_grid, exact=bool(exact))
+
+
+@then(step_parse('(?Pplacex?) has no entry for '
+ r'(?P[NRW])(?P\d+)(?::(?P\S+))?'),
+ converters={'osm_id': int})
+def check_place_missing_lines(db_conn, table, osm_type, osm_id, osm_class):
+ check_table_has_lines(db_conn, table, osm_type, osm_id, osm_class)
+
+
scenarios('features/osm2pgsql')
diff --git a/test/bdd/utils/grid.py b/test/bdd/utils/grid.py
index bc1db386..1a3d6ae8 100644
--- a/test/bdd/utils/grid.py
+++ b/test/bdd/utils/grid.py
@@ -32,3 +32,15 @@ class Grid:
""" Get the coordinates for the given grid node.
"""
return self.grid.get(nodeid)
+
+ def parse_point(self, value):
+ """ Get the coordinates for either a grid node or a full coordinate.
+ """
+ value = value.strip()
+ if ' ' in value:
+ return [int(v) for v in value.split(' ', 1)]
+
+ return self.grid.get(value)
+
+ def parse_line(self, value):
+ return [self.parse_point(p) for p in value.split(',')]