2 from pathlib import Path
4 from steps.geometry_factory import GeometryFactory
5 from steps.nominatim_environment import NominatimEnvironment
8 'BUILDDIR' : (Path(__file__) / '..' / '..' / '..' / 'build').resolve(),
9 'REMOVE_TEMPLATE' : False,
10 'KEEP_TEST_DB' : False,
15 'TEMPLATE_DB' : 'test_template_nominatim',
16 'TEST_DB' : 'test_nominatim',
17 'API_TEST_DB' : 'test_api_nominatim',
18 'SERVER_MODULE_PATH' : None,
19 'PHPCOV' : False, # set to output directory to enable code coverage
22 use_step_matcher("re")
24 def before_all(context):
26 context.config.setup_logging()
28 for k,v in userconfig.items():
29 context.config.userdata.setdefault(k, v)
30 # Nominatim test setup
31 context.nominatim = NominatimEnvironment(context.config.userdata)
32 context.osm = GeometryFactory()
35 def before_scenario(context, scenario):
36 if 'DB' in context.tags:
37 context.nominatim.setup_db(context)
38 elif 'APIDB' in context.tags:
39 context.nominatim.setup_api_db()
40 elif 'UNKNOWNDB' in context.tags:
41 context.nominatim.setup_unknown_db()
44 def after_scenario(context, scenario):
45 if 'DB' in context.tags:
46 context.nominatim.teardown_db(context)