diff --git a/swh/core/tests/storage_testing.py b/swh/core/tests/storage_testing.py new file mode 100644 --- /dev/null +++ b/swh/core/tests/storage_testing.py @@ -0,0 +1,34 @@ +# Copyright (C) 2015-2017 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 + +import tempfile + +from swh.core.tests.db_testing import DbTestFixture +from swh.storage import get_storage + + +class StorageTestFixture(DbTestFixture): + def setUp(self): + super().setUp() + self.objtmp = tempfile.TemporaryDirectory() + + storage_conf = { + 'cls': 'local', + 'args': { + 'db': self.conn, + 'objstorage': { + 'cls': 'pathslicing', + 'args': { + 'root': self.objtmp.name, + 'slicing': '0:1/1:5', + }, + }, + }, + } + self.storage = get_storage(**storage_conf) + + def tearDown(self): + self.objtmp.cleanup() + super().tearDown()