X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a4ecd9d73e93a56aeee336c7fa7e18aa42bd9e03..e4963256e1769cf56187d12c0b26b8be61e69b75:/tests/steps/terrain.py diff --git a/tests/steps/terrain.py b/tests/steps/terrain.py index 349deafe..0a4495e0 100644 --- a/tests/steps/terrain.py +++ b/tests/steps/terrain.py @@ -55,6 +55,7 @@ def run_nominatim_script(script, *args): proc = subprocess.Popen(cmd, cwd=world.config.source_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (outp, outerr) = proc.communicate() + logger.debug("run_nominatim_script: %s\n%s\n%s" % (cmd, outp, outerr)) assert (proc.returncode == 0), "Script '%s' failed:\n%s\n%s\n" % (script, outp, outerr) @world.absorb @@ -171,8 +172,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 @@ -181,6 +184,7 @@ def db_template_setup(): cwd=world.config.source_dir, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) [outstr, errstr] = proc.communicate(input='') + logger.debug("running osm2pgsql for template: %s\n%s\n%s" % (osm2pgsql, outstr, errstr)) world.run_nominatim_script('setup', 'create-functions', 'create-tables', 'create-partition-tables', 'create-partition-functions', 'load-data', 'create-search-indices')