1 from pathlib import Path
5 from steps.geometry_factory import GeometryFactory
6 from steps.nominatim_environment import NominatimEnvironment
8 TEST_BASE_DIR = Path(__file__) / '..' / '..'
11 'BUILDDIR' : (TEST_BASE_DIR / '..' / 'build').resolve(),
12 'REMOVE_TEMPLATE' : False,
13 'KEEP_TEST_DB' : False,
18 'TEMPLATE_DB' : 'test_template_nominatim',
19 'TEST_DB' : 'test_nominatim',
20 'API_TEST_DB' : 'test_api_nominatim',
21 'API_TEST_FILE' : (TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf').resolve(),
22 'SERVER_MODULE_PATH' : None,
23 'TOKENIZER' : None, # Test with a custom tokenizer
24 'PHPCOV' : False, # set to output directory to enable code coverage
27 use_step_matcher("re")
29 def before_all(context):
31 context.config.setup_logging()
33 for k,v in userconfig.items():
34 context.config.userdata.setdefault(k, v)
35 # Nominatim test setup
36 context.nominatim = NominatimEnvironment(context.config.userdata)
37 context.osm = GeometryFactory()
40 def before_scenario(context, scenario):
41 if 'DB' in context.tags:
42 context.nominatim.setup_db(context)
43 elif 'APIDB' in context.tags:
44 context.nominatim.setup_api_db()
45 elif 'UNKNOWNDB' in context.tags:
46 context.nominatim.setup_unknown_db()
49 def after_scenario(context, scenario):
50 if 'DB' in context.tags:
51 context.nominatim.teardown_db(context)