diff --git a/test/bdd/steps/db_ops.py b/test/bdd/steps/db_ops.py index fa66cd4d..869cf829 100644 --- a/test/bdd/steps/db_ops.py +++ b/test/bdd/steps/db_ops.py @@ -243,7 +243,14 @@ def update_place_table(context): col.db_insert(cur) context.db.commit() - context.nominatim.run_update_script('index') + + while True: + context.nominatim.run_update_script('index') + + cur = context.db.cursor() + cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1") + if cur.rowcount == 0: + break @when("marking for delete (?P.*)") def delete_places(context, oids): @@ -254,7 +261,14 @@ def delete_places(context, oids): where, params = NominatimID(oid).table_select() cur.execute("DELETE FROM place WHERE " + where, params) context.db.commit() - context.nominatim.run_update_script('index') + + while True: + context.nominatim.run_update_script('index') + + cur = context.db.cursor() + cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1") + if cur.rowcount == 0: + break @then("placex contains(?P exactly)?") def check_placex_contents(context, exact):