Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/pytest_plugin.py
# Copyright (C) 2019-2022 The Software Heritage developers | # Copyright (C) 2019-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from functools import partial | from functools import partial | ||||
from os import environ | from os import environ | ||||
import pytest | import pytest | ||||
from pytest_postgresql import factories | from pytest_postgresql import factories | ||||
from swh.core.db.pytest_plugin import initialize_database_for_module | from swh.core.db.pytest_plugin import initialize_database_for_module | ||||
from swh.storage import get_storage | from swh.storage import get_storage | ||||
from swh.storage.postgresql.db import Db as StorageDb | from swh.storage.postgresql.storage import Storage as StorageDatastore | ||||
from swh.storage.tests.storage_data import StorageData | from swh.storage.tests.storage_data import StorageData | ||||
environ["LC_ALL"] = "C.UTF-8" | environ["LC_ALL"] = "C.UTF-8" | ||||
swh_storage_postgresql_proc = factories.postgresql_proc( | swh_storage_postgresql_proc = factories.postgresql_proc( | ||||
load=[ | load=[ | ||||
partial( | partial( | ||||
initialize_database_for_module, | initialize_database_for_module, | ||||
modname="storage", | modname="storage", | ||||
version=StorageDb.current_version, | version=StorageDatastore.current_version, | ||||
) | ) | ||||
], | ], | ||||
) | ) | ||||
swh_storage_postgresql = factories.postgresql( | swh_storage_postgresql = factories.postgresql( | ||||
"swh_storage_postgresql_proc", | "swh_storage_postgresql_proc", | ||||
) | ) | ||||
Show All 32 Lines |