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 'PHPCOV' : False, # set to output directory to enable code coverage
26 use_step_matcher("re")
28 def before_all(context):
30 context.config.setup_logging()
32 for k,v in userconfig.items():
33 context.config.userdata.setdefault(k, v)
34 # Nominatim test setup
35 context.nominatim = NominatimEnvironment(context.config.userdata)
36 context.osm = GeometryFactory()
39 def before_scenario(context, scenario):
40 if 'DB' in context.tags:
41 context.nominatim.setup_db(context)
42 elif 'APIDB' in context.tags:
43 context.nominatim.setup_api_db()
44 elif 'UNKNOWNDB' in context.tags:
45 context.nominatim.setup_unknown_db()
48 def after_scenario(context, scenario):
49 if 'DB' in context.tags:
50 context.nominatim.teardown_db(context)