From de2a3bd5f8c2a4a40da1f2153afdb69e387dbcd2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 4 Oct 2022 17:01:25 +0200 Subject: [PATCH] bdd tests: make import style configurable The switch is for development. Tests are not guaranteed to still work when run with anything but the 'extratags' style. --- test/bdd/environment.py | 1 + test/bdd/steps/nominatim_environment.py | 3 +++ test/bdd/steps/steps_osm_data.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/bdd/environment.py b/test/bdd/environment.py index c11a2c8c..7a7b943d 100644 --- a/test/bdd/environment.py +++ b/test/bdd/environment.py @@ -27,6 +27,7 @@ userconfig = { 'API_TEST_FILE' : (TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf').resolve(), 'SERVER_MODULE_PATH' : None, 'TOKENIZER' : None, # Test with a custom tokenizer + 'STYLE' : 'extratags', 'PHPCOV' : False, # set to output directory to enable code coverage } diff --git a/test/bdd/steps/nominatim_environment.py b/test/bdd/steps/nominatim_environment.py index 1feafd75..5145327c 100644 --- a/test/bdd/steps/nominatim_environment.py +++ b/test/bdd/steps/nominatim_environment.py @@ -36,6 +36,7 @@ class NominatimEnvironment: self.api_test_db = config['API_TEST_DB'] self.api_test_file = config['API_TEST_FILE'] self.tokenizer = config['TOKENIZER'] + self.import_style = config['STYLE'] self.server_module_path = config['SERVER_MODULE_PATH'] self.reuse_template = not config['REMOVE_TEMPLATE'] self.keep_scenario_db = config['KEEP_TEST_DB'] @@ -107,6 +108,8 @@ class NominatimEnvironment: self.test_env['NOMINATIM_NOMINATIM_TOOL'] = str((self.build_dir / 'nominatim').resolve()) if self.tokenizer is not None: self.test_env['NOMINATIM_TOKENIZER'] = self.tokenizer + if self.import_style is not None: + self.test_env['NOMINATIM_IMPORT_STYLE'] = self.import_style if self.server_module_path: self.test_env['NOMINATIM_DATABASE_MODULE_PATH'] = self.server_module_path diff --git a/test/bdd/steps/steps_osm_data.py b/test/bdd/steps/steps_osm_data.py index 94f72796..6271f6b8 100644 --- a/test/bdd/steps/steps_osm_data.py +++ b/test/bdd/steps/steps_osm_data.py @@ -17,7 +17,7 @@ def get_osm2pgsql_options(nominatim_env, fname, append): return dict(import_file=fname, osm2pgsql=str(nominatim_env.build_dir / 'osm2pgsql' / 'osm2pgsql'), osm2pgsql_cache=50, - osm2pgsql_style=str(nominatim_env.src_dir / 'settings' / 'import-extratags.style'), + osm2pgsql_style=str(nominatim_env.get_test_config().get_import_style_file()), threads=1, dsn=nominatim_env.get_libpq_dsn(), flatnode_file='', -- 2.39.5