swh.indexer.storage: Unify get_indexer_storage function with others
Trying to sense a bit better on how to converge with what's described in the hackmd discussion [1]
(also, we have those kinds of tests on at least the storage and search).
Impacts [2]:
-
D4272: swh-indexer -
swh-web!1020 (closed): swh-web -
[1] https://hackmd.io/8hxTL4XMQoO2RVKtqFqM2g?view#Synthesis-of-discussion-tenmadouarddaolasd-2020-10-12
-
[2]
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/cli.py: from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/cli.py: get_indexer_storage, ctx.obj["config"], "indexer_storage", indexer_storage_url
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/indexer.py:from swh.indexer.storage import INDEXER_CFG_KEY, PagedResult, Sha1, get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/indexer.py: self.idx_storage = get_indexer_storage(**idx_storage)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/conftest.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/conftest.py: idx_storage = get_indexer_storage("memory")
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_api_client.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_api_client.py: server.storage = get_indexer_storage("local", db=swh_indexer_storage_postgresql.dsn)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/conftest.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/conftest.py: return get_indexer_storage("local", db=swh_indexer_storage_postgresql.dsn)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py:from swh.indexer.storage import IndexerStorage, get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py:def test_init_get_indexer_storage_failure():
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py: get_indexer_storage("unknown-idx-storage")
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py:def test_init_get_indexer_storage(class_name, expected_class, kwargs, mock_psycopg2):
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py: concrete_idx_storage = get_indexer_storage(class_name, **kwargs)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py: concrete_idx_storage = get_indexer_storage(class_name)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py:def test_init_get_indexer_storage_deprecation_warning(
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_init.py: concrete_idx_storage = get_indexer_storage(class_name, args=kwargs)
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_in_memory.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/tests/storage/test_in_memory.py: return get_indexer_storage("memory")
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/api/server.py:from swh.indexer.storage import INDEXER_CFG_KEY, get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/api/server.py: storage = get_indexer_storage(**app.config[INDEXER_CFG_KEY])
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/__init__.py:def get_indexer_storage(cls: str, **kwargs) -> IndexerStorageInterface:
$SWH_ENVIRONMENT_HOME/swh-web/swh/web/config.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-web/swh/web/config.py: swhweb_config["indexer_storage"] = get_indexer_storage(
$SWH_ENVIRONMENT_HOME/swh-web/swh/web/tests/data.py:from swh.indexer.storage import get_indexer_storage
$SWH_ENVIRONMENT_HOME/swh-web/swh/web/tests/data.py: idx_storage = get_indexer_storage("memory")
Related to swh-core#1410
Test Plan
tox
Migrated from D4272 (view on Phabricator)