2 from pathlib import Path
4 from steps.geometry_factory import GeometryFactory
5 from steps.nominatim_environment import NominatimEnvironment
7 TEST_BASE_DIR = Path(__file__) / '..' / '..'
10 'BUILDDIR' : (TEST_BASE_DIR / '..' / 'build').resolve(),
11 'REMOVE_TEMPLATE' : False,
12 'KEEP_TEST_DB' : False,
17 'TEMPLATE_DB' : 'test_template_nominatim',
18 'TEST_DB' : 'test_nominatim',
19 'API_TEST_DB' : 'test_api_nominatim',
20 'API_TEST_FILE' : (TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf').resolve(),
21 'SERVER_MODULE_PATH' : None,
22 'PHPCOV' : False, # set to output directory to enable code coverage
25 use_step_matcher("re")
27 def before_all(context):
29 context.config.setup_logging()
31 for k,v in userconfig.items():
32 context.config.userdata.setdefault(k, v)
33 # Nominatim test setup
34 context.nominatim = NominatimEnvironment(context.config.userdata)
35 context.osm = GeometryFactory()
38 def before_scenario(context, scenario):
39 if 'DB' in context.tags:
40 context.nominatim.setup_db(context)
41 elif 'APIDB' in context.tags:
42 context.nominatim.setup_api_db()
43 elif 'UNKNOWNDB' in context.tags:
44 context.nominatim.setup_unknown_db()
47 def after_scenario(context, scenario):
48 if 'DB' in context.tags:
49 context.nominatim.teardown_db(context)