Skip to content

Commit 02968c8

Browse files
committed
drop sha256
1 parent d5fef73 commit 02968c8

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright (c) 2026 Scipp contributors (https://github.com/scipp)
33

4-
import hashlib
54
from pathlib import Path
65

76
import pooch
87

98
from tof.facilities import _BASE_URLS, _source_library
109

1110

12-
def sha256(p: Path) -> str:
13-
h = hashlib.sha256()
14-
with p.open("rb") as f:
15-
for chunk in iter(lambda: f.read(1024 * 1024), b""):
16-
h.update(chunk)
17-
return h.hexdigest()
18-
19-
2011
def test_source_library_files_identical_on_public_and_github(tmp_path: Path) -> None:
2112
registry = {f["path"]: f["hash"] for f in _source_library.values()}
2213

@@ -28,11 +19,14 @@ def test_source_library_files_identical_on_public_and_github(tmp_path: Path) ->
2819
path=tmp_path / "cache_github", base_url=_BASE_URLS[1], registry=registry
2920
)
3021

31-
for name, entry in _source_library.items():
22+
for entry in _source_library.values():
3223
rel = entry["path"]
3324

25+
# Verify that hashes are the same in both registries.
26+
assert public.registry[rel] == gh.registry[rel]
27+
3428
p_gh = Path(gh.fetch(rel))
3529
p_public = Path(public.fetch(rel))
3630

37-
# registry already verifies md5, but we compare content across hosts:
38-
assert sha256(p_gh) == sha256(p_public), f"Mismatch for {name} ({rel})"
31+
assert p_gh.stem == p_public.stem
32+
assert p_gh.suffix == p_public.suffix

0 commit comments

Comments
 (0)