1import pathlib
    2 
    3import pytest
    4 
    5from testsuite.databases.pgsql import discover
    6 
    7 
    8pytest_plugins = ['pytest_userver.plugins.postgresql']
    9 
   10 
   11@pytest.fixture(scope='session')
   12def prepare_service_config():
   13    def patch_config(config, config_vars):
   14        pass
   15 
   16    return patch_config
   17 
   18 
   19@pytest.fixture(scope='session')
   20def service_source_dir():
   21    """Path to root directory service."""
   22    return pathlib.Path(__file__).parent.parent
   23 
   24 
   25@pytest.fixture(scope='session')
   26def initial_data_path(service_source_dir):
   27    """Path for find files with data"""
   28    return [service_source_dir / 'postgresql/data']
   29 
   30 
   31@pytest.fixture(scope='session')
   32def pgsql_local(service_source_dir, pgsql_local_create):
   33    """Create schemas databases for tests"""
   34    databases = discover.find_schemas(
   35        'auth', [service_source_dir.joinpath('postgresql/schemas')],
   36    )
   37    return pgsql_local_create(list(databases.values()))