]> git.openstreetmap.org Git - nominatim.git/commitdiff
bdd tests: make import style configurable
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 4 Oct 2022 15:01:25 +0000 (17:01 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 10 Nov 2022 08:37:38 +0000 (09:37 +0100)
The switch is for development. Tests are not guaranteed to still
work when run with anything but the 'extratags' style.

test/bdd/environment.py
test/bdd/steps/nominatim_environment.py
test/bdd/steps/steps_osm_data.py

index c11a2c8cdbeef9a274782dd158daf448348abb41..7a7b943d8e6af050fc6d9e8f89b9ceda9b1fc26f 100644 (file)
@@ -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
 }
 
index 1feafd751891a1355e51db0804ba38e03b7fee26..5145327cc81bce2462824d46e827bd6ff4b47132 100644 (file)
@@ -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
index 94f727966af621a9011795c4f08c37a85819dc66..6271f6b827dae37c9fb8423a0af016af7d19288e 100644 (file)
@@ -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='',