diff --git a/swh/loader/package/nixguix/tests/test_nixguix.py b/swh/loader/package/nixguix/tests/test_nixguix.py --- a/swh/loader/package/nixguix/tests/test_nixguix.py +++ b/swh/loader/package/nixguix/tests/test_nixguix.py @@ -59,7 +59,23 @@ (TargetType.REVISION, b"evaluation") ], ): - return check_snapshot_full(snapshot, storage, allowed_empty) + check_snapshot_full(snapshot, storage, allowed_empty) + + assert isinstance(snapshot, Snapshot) + # then ensure the snapshot revisions are structurally as expected + revision_ids = [] + for name, branch in snapshot.branches.items(): + if name == b"evaluation": + continue # skipping that particular branch + if branch.target_type == TargetType.REVISION: + revision_ids.append(branch.target) + + revisions = storage.revision_get(revision_ids) + for rev in revisions: + metadata = rev["metadata"] + raw = metadata["extrinsic"]["raw"] + assert "url" in raw + assert "integrity" in raw def test_retrieve_sources(swh_config, requests_mock_datadir): @@ -119,25 +135,6 @@ assert len(clean["sources"]) == 1 -def check_snapshot_revisions_ok(snapshot: Snapshot, storage: StorageInterface): - """Ensure the snapshot revisions are structurally as expected - - """ - revision_ids = [] - for name, branch in snapshot.branches.items(): - if name == b"evaluation": - continue # skipping that particular branch - if branch.target_type == TargetType.REVISION: - revision_ids.append(branch.target) - - revisions = storage.revision_get(revision_ids) - for rev in revisions: - metadata = rev["metadata"] - raw = metadata["extrinsic"]["raw"] - assert "url" in raw - assert "integrity" in raw - - def test_loader_one_visit(swh_config, requests_mock_datadir): loader = NixGuixLoader(sources_url) res = loader.load() @@ -206,7 +203,6 @@ ) check_snapshot(SNAPSHOT1, storage=loader.storage) - check_snapshot_revisions_ok(SNAPSHOT1, loader.storage) urls = [ m.url @@ -241,7 +237,6 @@ ) check_snapshot(SNAPSHOT1, storage=loader.storage) - check_snapshot_revisions_ok(SNAPSHOT1, loader.storage) stats = get_stats(loader.storage) assert { @@ -294,7 +289,6 @@ }, ) check_snapshot(expected_snapshot, storage=loader.storage) - check_snapshot_revisions_ok(expected_snapshot, loader.storage) stats = get_stats(loader.storage) assert { @@ -338,7 +332,6 @@ ) check_snapshot(SNAPSHOT1, storage=loader.storage) - check_snapshot_revisions_ok(SNAPSHOT1, loader.storage) def test_eoferror(swh_config, requests_mock_datadir): @@ -364,7 +357,6 @@ ) check_snapshot(expected_snapshot, storage=loader.storage) - check_snapshot_revisions_ok(expected_snapshot, loader.storage) def fake_download( @@ -400,7 +392,6 @@ } check_snapshot(SNAPSHOT1, storage=loader.storage) - check_snapshot_revisions_ok(SNAPSHOT1, loader.storage) assert len(mock_download.mock_calls) == 2