X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/7879ad44cd1e36ae1235c3dcdfd9e477491813e4..91e1e4d614edcd13dc19ac1409a9cf812ead964c:/tests/steps/terrain.py?ds=sidebyside diff --git a/tests/steps/terrain.py b/tests/steps/terrain.py index 0569578a..80beebd5 100644 --- a/tests/steps/terrain.py +++ b/tests/steps/terrain.py @@ -175,8 +175,10 @@ def db_template_setup(): conn = psycopg2.connect(database=world.config.template_db) psycopg2.extras.register_hstore(conn, globally=False, unicode=True) cur = conn.cursor() - for table in ('gb_postcode', 'us_postcode', 'us_state', 'us_statecounty'): - cur.execute('TRUNCATE TABLE %s' % (table,)) + for table in ('gb_postcode', 'us_postcode'): + cur.execute("select * from pg_tables where tablename = '%s'" % (table, )) + if cur.rowcount > 0: + cur.execute('TRUNCATE TABLE %s' % (table,)) conn.commit() conn.close() # execute osm2pgsql on an empty file to get the right tables