X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/86d90bc46005c00f2367ad759804f528adc4c6a5..443bfec0350085788ddcc6b5ca5a541e2321ec64:/tests/steps/db_setup.py diff --git a/tests/steps/db_setup.py b/tests/steps/db_setup.py index 7d1ea8d3..23d526f8 100644 --- a/tests/steps/db_setup.py +++ b/tests/steps/db_setup.py @@ -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): @@ -181,9 +184,9 @@ def import_fill_planet_osm_rels(step): if not members: members = None - cur.execute("""INSERT INTO planet_osm_rels - (id, way_off, rel_off, parts, members, tags, pending) - VALUES (%s, %s, %s, %s, %s, %s, false)""", + cur.execute("""INSERT INTO planet_osm_rels + (id, way_off, rel_off, parts, members, tags) + VALUES (%s, %s, %s, %s, %s, %s)""", (line['id'], len(parts['n']), len(parts['n']) + len(parts['w']), parts['n'] + parts['w'] + parts['r'], members, tags)) world.conn.commit() @@ -199,9 +202,8 @@ def import_fill_planet_osm_ways(step): tags = None nodes = [int(x.strip()) for x in line['nodes'].split(',')] - cur.execute("""INSERT INTO planet_osm_ways - (id, nodes, tags, pending) - VALUES (%s, %s, %s, false)""", + cur.execute("""INSERT INTO planet_osm_ways (id, nodes, tags) + VALUES (%s, %s, %s)""", (line['id'], nodes, tags)) world.conn.commit() @@ -213,8 +215,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,10 +265,12 @@ 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 - world.response_format = 'json' + world.response_format = 'json' + world.request_type = 'search' world.returncode = 200