Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/tests/conftest.py
Show All 27 Lines | def tmp_path(): | ||||
with tempfile.TemporaryDirectory() as tmpdir: | with tempfile.TemporaryDirectory() as tmpdir: | ||||
yield pathlib.Path(tmpdir) | yield pathlib.Path(tmpdir) | ||||
VAULT_SQL_DIR = os.path.join(os.path.dirname(swh.vault.__file__), "sql") | VAULT_SQL_DIR = os.path.join(os.path.dirname(swh.vault.__file__), "sql") | ||||
postgres_vault = postgresql_fact( | postgres_vault = postgresql_fact( | ||||
"postgresql_proc", db_name="vault", dump_files=f"{VAULT_SQL_DIR}/*.sql" | "postgresql_proc", dbname="vault", dump_files=f"{VAULT_SQL_DIR}/*.sql" | ||||
) | ) | ||||
postgres_storage = postgresql_fact( | postgres_storage = postgresql_fact( | ||||
"postgresql_proc", db_name="storage", dump_files=f"{STORAGE_SQL_DIR}/*.sql" | "postgresql_proc", dbname="storage", dump_files=f"{STORAGE_SQL_DIR}/*.sql" | ||||
) | ) | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_vault_config(postgres_vault, postgres_storage, tmp_path) -> Dict[str, Any]: | def swh_vault_config(postgres_vault, postgres_storage, tmp_path) -> Dict[str, Any]: | ||||
tmp_path = str(tmp_path) | tmp_path = str(tmp_path) | ||||
return { | return { | ||||
"db": postgres_vault.dsn, | "db": postgres_vault.dsn, | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |