forked from hans/Nominatim
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
|
self.template_db_done = True
|
||||||
|
|
||||||
if self._reuse_or_drop_db(self.template_db):
|
|
||||||
return
|
|
||||||
|
|
||||||
self.write_nominatim_config(self.template_db)
|
self.write_nominatim_config(self.template_db)
|
||||||
|
|
||||||
try:
|
if not self._reuse_or_drop_db(self.template_db):
|
||||||
# execute nominatim import on an empty file to get the right tables
|
try:
|
||||||
with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd:
|
# execute nominatim import on an empty file to get the right tables
|
||||||
fd.write(b'<osm version="0.6"></osm>')
|
with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd:
|
||||||
fd.flush()
|
fd.write(b'<osm version="0.6"></osm>')
|
||||||
self.run_nominatim('import', '--osm-file', fd.name,
|
fd.flush()
|
||||||
'--osm2pgsql-cache', '1',
|
self.run_nominatim('import', '--osm-file', fd.name,
|
||||||
'--ignore-errors',
|
'--osm2pgsql-cache', '1',
|
||||||
'--offline', '--index-noanalyse')
|
'--ignore-errors',
|
||||||
except:
|
'--offline', '--index-noanalyse')
|
||||||
self.db_drop_database(self.template_db)
|
except:
|
||||||
raise
|
self.db_drop_database(self.template_db)
|
||||||
|
raise
|
||||||
|
|
||||||
|
self.run_nominatim('refresh', '--functions')
|
||||||
|
|
||||||
|
|
||||||
def setup_api_db(self):
|
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):
|
def import_and_index_data_from_place_table(context):
|
||||||
""" Import data previously set up in the place table.
|
""" Import data previously set up in the place table.
|
||||||
"""
|
"""
|
||||||
context.nominatim.run_nominatim('refresh', '--functions')
|
|
||||||
context.nominatim.run_nominatim('import', '--continue', 'load-data',
|
context.nominatim.run_nominatim('import', '--continue', 'load-data',
|
||||||
'--index-noanalyse', '-q',
|
'--index-noanalyse', '-q',
|
||||||
'--offline')
|
'--offline')
|
||||||
|
|||||||
Reference in New Issue
Block a user