5from testsuite.databases.pgsql
import discover
7pytest_plugins = [
'pytest_userver.plugins.postgresql']
9USERVER_CONFIG_HOOKS = [
'userver_actions_service']
12@pytest.fixture(scope='session')
13def service_source_dir():
14 """Path to root directory service."""
15 return pathlib.Path(__file__).parent.parent
18@pytest.fixture(scope='session')
19def initial_data_path(service_source_dir):
20 """Path for find files with data"""
21 return [service_source_dir /
'postgresql/data']
24@pytest.fixture(scope='session')
25def userver_actions_service(mockserver_info):
26 def do_patch(config_yaml, config_vars):
27 components = config_yaml[
'components_manager'][
'components']
28 components[
'action-client'][
'service-url'] = mockserver_info.url(
35@pytest.fixture(scope='session')
36def pgsql_local(service_source_dir, pgsql_local_create):
37 """Create schemas databases for tests"""
38 databases = discover.find_schemas(
39 'pg_service_template',
40 [service_source_dir.joinpath(
'postgresql/schemas')],
42 return pgsql_local_create(list(databases.values()))