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:
Sarah Hoffmann
2022-05-11 15:50:22 +02:00
parent aa0ae610c6
commit e74e577029
2 changed files with 15 additions and 16 deletions

View File

@@ -172,11 +172,9 @@ 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)
if not self._reuse_or_drop_db(self.template_db):
try: try:
# execute nominatim import on an empty file to get the right tables # execute nominatim import on an empty file to get the right tables
with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd: with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.xml') as fd:
@@ -190,6 +188,8 @@ class NominatimEnvironment:
self.db_drop_database(self.template_db) self.db_drop_database(self.template_db)
raise raise
self.run_nominatim('refresh', '--functions')
def setup_api_db(self): def setup_api_db(self):
""" Setup a test against the API test database. """ Setup a test against the API test database.

View File

@@ -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')