mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 18:37:58 +00:00
bdd: recreate functions on template DB
Avoids calling function refresh on every scenario. The content won't change between runs.
This commit is contained in:
@@ -172,23 +172,23 @@ class NominatimEnvironment:
|
||||
|
||||
self.template_db_done = True
|
||||
|
||||
if self._reuse_or_drop_db(self.template_db):
|
||||
return
|
||||
|
||||
self.write_nominatim_config(self.template_db)
|
||||
|
||||
try:
|
||||
# execute nominatim import on an empty file to get the right tables
|
||||
with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd:
|
||||
fd.write(b'<osm version="0.6"></osm>')
|
||||
fd.flush()
|
||||
self.run_nominatim('import', '--osm-file', fd.name,
|
||||
'--osm2pgsql-cache', '1',
|
||||
'--ignore-errors',
|
||||
'--offline', '--index-noanalyse')
|
||||
except:
|
||||
self.db_drop_database(self.template_db)
|
||||
raise
|
||||
if not self._reuse_or_drop_db(self.template_db):
|
||||
try:
|
||||
# execute nominatim import on an empty file to get the right tables
|
||||
with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd:
|
||||
fd.write(b'<osm version="0.6"></osm>')
|
||||
fd.flush()
|
||||
self.run_nominatim('import', '--osm-file', fd.name,
|
||||
'--osm2pgsql-cache', '1',
|
||||
'--ignore-errors',
|
||||
'--offline', '--index-noanalyse')
|
||||
except:
|
||||
self.db_drop_database(self.template_db)
|
||||
raise
|
||||
|
||||
self.run_nominatim('refresh', '--functions')
|
||||
|
||||
|
||||
def setup_api_db(self):
|
||||
|
||||
@@ -93,7 +93,6 @@ def add_data_to_planet_ways(context):
|
||||
def import_and_index_data_from_place_table(context):
|
||||
""" Import data previously set up in the place table.
|
||||
"""
|
||||
context.nominatim.run_nominatim('refresh', '--functions')
|
||||
context.nominatim.run_nominatim('import', '--continue', 'load-data',
|
||||
'--index-noanalyse', '-q',
|
||||
'--offline')
|
||||
|
||||
Reference in New Issue
Block a user