1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2024 by the Nominatim developer community.
6 # For a full list of authors see the git log.
7 from pathlib import Path
12 sys.path.insert(1, str(Path(__file__, '..', '..', '..', 'src').resolve()))
14 from steps.geometry_factory import GeometryFactory
15 from steps.nominatim_environment import NominatimEnvironment
17 TEST_BASE_DIR = Path(__file__, '..', '..').resolve()
20 'REMOVE_TEMPLATE' : False,
21 'KEEP_TEST_DB' : False,
26 'TEMPLATE_DB' : 'test_template_nominatim',
27 'TEST_DB' : 'test_nominatim',
28 'API_TEST_DB' : 'test_api_nominatim',
29 'API_TEST_FILE' : TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf',
30 'SERVER_MODULE_PATH' : None,
31 'TOKENIZER' : None, # Test with a custom tokenizer
32 'STYLE' : 'extratags',
33 'API_ENGINE': 'falcon'
36 use_step_matcher("re")
38 def before_all(context):
40 context.config.setup_logging()
42 for k,v in userconfig.items():
43 context.config.userdata.setdefault(k, v)
44 # Nominatim test setup
45 context.nominatim = NominatimEnvironment(context.config.userdata)
46 context.osm = GeometryFactory()
49 def before_scenario(context, scenario):
50 if not 'SQLITE' in context.tags \
51 and context.config.userdata['API_TEST_DB'].startswith('sqlite:'):
52 context.scenario.skip("Not usable with Sqlite database.")
53 elif 'DB' in context.tags:
54 context.nominatim.setup_db(context)
55 elif 'APIDB' in context.tags:
56 context.nominatim.setup_api_db()
57 elif 'UNKNOWNDB' in context.tags:
58 context.nominatim.setup_unknown_db()
60 def after_scenario(context, scenario):
61 if 'DB' in context.tags:
62 context.nominatim.teardown_db(context)