Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/pytest_plugin.py
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | yield { | ||||
"cls": "postgresql", | "cls": "postgresql", | ||||
"db": swh_storage_postgresql.dsn, | "db": swh_storage_postgresql.dsn, | ||||
"objstorage": {"cls": "memory"}, | "objstorage": {"cls": "memory"}, | ||||
"check_config": {"check_write": True}, | "check_config": {"check_write": True}, | ||||
} | } | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_storage(swh_storage_backend_config): | def swh_storage_backend(swh_storage_backend_config): | ||||
""" | |||||
By default, this fixture aliases ``swh_storage``. However, when ``swh_storage`` | |||||
is overridden to be a proxy storage, this fixture returns the storage instance | |||||
behind all proxies. | |||||
This is useful to introspect the state of backends from proxy tests""" | |||||
return get_storage(**swh_storage_backend_config) | return get_storage(**swh_storage_backend_config) | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_storage(swh_storage_backend): | |||||
return swh_storage_backend | |||||
@pytest.fixture | |||||
def sample_data() -> StorageData: | def sample_data() -> StorageData: | ||||
"""Pre-defined sample storage object data to manipulate | """Pre-defined sample storage object data to manipulate | ||||
Returns: | Returns: | ||||
StorageData whose attribute keys are data model objects. Either multiple | StorageData whose attribute keys are data model objects. Either multiple | ||||
objects: contents, directories, revisions, releases, ... or simple ones: | objects: contents, directories, revisions, releases, ... or simple ones: | ||||
content, directory, revision, release, ... | content, directory, revision, release, ... | ||||
""" | """ | ||||
return StorageData() | return StorageData() |