]> git.openstreetmap.org Git - nominatim.git/blobdiff - tests/steps/db_setup.py
Fix coding style.
[nominatim.git] / tests / steps / db_setup.py
index 7d1ea8d3c11a59341d995ca3dfb1d1556d5377d0..8041c6cc6070ad49791a5eb8c0a022a046256e9e 100644 (file)
@@ -95,6 +95,9 @@ def _format_placex_cols(cols, geomtype, force_name):
         else:
             coords = "'%s'::geometry" % coords.wkt
         cols['geometry'] = coords
+    for k in cols:
+        if not cols[k]:
+            cols[k] = None
 
 
 def _insert_place_table_nodes(places, force_name):
@@ -213,8 +216,8 @@ def import_database(step):
     world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions')
     cur = world.conn.cursor()
     cur.execute("""insert into placex (osm_type, osm_id, class, type, name, admin_level,
-                              housenumber, street, addr_place, isin, postcode, country_code, extratags,
-                              geometry) select * from place""")
+                   housenumber, street, addr_place, isin, postcode, country_code, extratags,
+                   geometry) select * from place""")
     world.conn.commit()
     world.run_nominatim_script('setup', 'index', 'index-noanalyse')
     #world.db_dump_table('placex')
@@ -263,7 +266,8 @@ def query_cmd(step, query, with_dups):
            '--search', query]
     if with_dups is not None:
         cmd.append('--nodedupe')
-    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    proc = subprocess.Popen(cmd, cwd=world.config.source_dir,
+                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     (outp, err) = proc.communicate()
     assert (proc.returncode == 0), "query.php failed with message: %s" % err
     world.page = outp