diff --git a/swh/indexer/tests/conftest.py b/swh/indexer/tests/conftest.py --- a/swh/indexer/tests/conftest.py +++ b/swh/indexer/tests/conftest.py @@ -1,3 +1,8 @@ +# Copyright (C) 2019-2020 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + from datetime import timedelta from unittest.mock import patch @@ -5,9 +10,8 @@ from swh.objstorage import get_objstorage from swh.scheduler.tests.conftest import * # noqa -from swh.storage.in_memory import Storage - -from swh.indexer.storage.in_memory import IndexerStorage +from swh.storage import get_storage +from swh.indexer.storage import get_indexer_storage from .utils import fill_storage, fill_obj_storage @@ -34,8 +38,8 @@ def idx_storage(): """An instance of swh.indexer.storage.in_memory.IndexerStorage that gets injected into all indexers classes.""" - idx_storage = IndexerStorage() - with patch('swh.indexer.storage.in_memory.IndexerStorage') \ + idx_storage = get_indexer_storage('memory', {}) + with patch('swh.indexer.storage.get_indexer_storage') \ as idx_storage_mock: idx_storage_mock.return_value = idx_storage yield idx_storage @@ -45,9 +49,9 @@ def storage(): """An instance of swh.storage.in_memory.Storage that gets injected into all indexers classes.""" - storage = Storage() + storage = get_storage('memory') fill_storage(storage) - with patch('swh.storage.in_memory.Storage') as storage_mock: + with patch('swh.storage.get_storage') as storage_mock: storage_mock.return_value = storage yield storage @@ -58,7 +62,7 @@ that gets injected into all indexers classes.""" objstorage = get_objstorage('memory', {}) fill_obj_storage(objstorage) - with patch.dict('swh.objstorage._STORAGE_CLASSES', + with patch.dict('swh.objstorage.get_objstorage', {'memory': lambda: objstorage}): yield objstorage