Page MenuHomeSoftware Heritage

D3444.id12205.diff
No OneTemporary

D3444.id12205.diff

diff --git a/swh/loader/tests/__init__.py b/swh/loader/tests/__init__.py
--- a/swh/loader/tests/__init__.py
+++ b/swh/loader/tests/__init__.py
@@ -116,20 +116,7 @@
expected_branches = expected_snapshot["branches"]
snap = storage.snapshot_get(hash_to_bytes(expected_snapshot_id))
if snap is None:
- # display known snapshots instead if possible
- if hasattr(storage, "_snapshots"): # in-mem storage
- from pprint import pprint
-
- for snap_id, (_snap, _) in storage._snapshots.items():
- snapd = _snap.to_dict()
- snapd["id"] = hash_to_hex(snapd["id"])
- branches = {
- branch.decode("utf-8"): decode_target(target)
- for branch, target in snapd["branches"].items()
- }
- snapd["branches"] = branches
- pprint(snapd)
- raise AssertionError("Snapshot is not found")
+ raise AssertionError(f"Snapshot {expected_snapshot_id} is not found")
branches = {
branch.decode("utf-8"): decode_target(target)
diff --git a/swh/loader/tests/test_init.py b/swh/loader/tests/test_init.py
--- a/swh/loader/tests/test_init.py
+++ b/swh/loader/tests/test_init.py
@@ -243,11 +243,16 @@
}
unexpected_snapshot = {
- "id": "2498dbf535f882bc7f9a18fb16c9ad27fda7bab7",
+ "id": "2498dbf535f882bc7f9a18fb16c9ad27fda7bab7", # id is correct
"branches": {
- "master": {"target": hash_hex, "target_type": "release",} # wrong value
+ "master": {"target": hash_hex, "target_type": "release",} # wrong branch
},
}
- with pytest.raises(AssertionError):
+ with pytest.raises(AssertionError, match="Differing items"):
+ check_snapshot(unexpected_snapshot, storage)
+
+ # snapshot id which does not exist
+ unexpected_snapshot["id"] = "999666f535f882bc7f9a18fb16c9ad27fda7bab7"
+ with pytest.raises(AssertionError, match="is not found"):
check_snapshot(unexpected_snapshot, storage)

File Metadata

Mime Type
text/plain
Expires
Jul 3 2025, 7:59 AM (10 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220280

Event Timeline