diff --git a/swh/storage/tests/algos/test_snapshot.py b/swh/storage/tests/algos/test_snapshot.py index 912fb4c2..7e7bafc9 100644 --- a/swh/storage/tests/algos/test_snapshot.py +++ b/swh/storage/tests/algos/test_snapshot.py @@ -1,36 +1,44 @@ # Copyright (C) 2018 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 hypothesis import given +import pytest from swh.model.identifiers import snapshot_identifier, identifier_to_bytes from swh.model.hypothesis_strategies import snapshots, branch_names, branch_targets from swh.storage.algos.snapshot import snapshot_get_all_branches -from swh.storage.tests.test_in_memory import swh_storage_backend_config # noqa + + +@pytest.fixture +def swh_storage_backend_config(): + yield { + "cls": "memory", + "journal_writer": None, + } @given(snapshot=snapshots(min_size=0, max_size=10, only_objects=False)) def test_snapshot_small(swh_storage, snapshot): # noqa snapshot = snapshot.to_dict() swh_storage.snapshot_add([snapshot]) returned_snapshot = snapshot_get_all_branches(swh_storage, snapshot["id"]) assert snapshot == returned_snapshot @given(branch_name=branch_names(), branch_target=branch_targets(only_objects=True)) def test_snapshot_large(swh_storage, branch_name, branch_target): # noqa branch_target = branch_target.to_dict() snapshot = { "branches": {b"%s%05d" % (branch_name, i): branch_target for i in range(10000)} } snapshot["id"] = identifier_to_bytes(snapshot_identifier(snapshot)) swh_storage.snapshot_add([snapshot]) returned_snapshot = snapshot_get_all_branches(swh_storage, snapshot["id"]) assert snapshot == returned_snapshot