@@ -44,12 +44,11 @@ def test_compute_file_hash_algorithms(tmp_path: Path, algorithm: HashAlgo, data:
4444 fp = tmp_path / "x.bin"
4545 _write (fp , data )
4646
47- cache : dict [Path , str ] = {}
48- actual = compute_file_hash (fp , algorithm , git_hash_cache = cache )
47+ actual = compute_file_hash (fp , algorithm )
4948 assert actual == expected_fn (data )
5049
5150
52- def test_compute_file_hash_git_sha1_uses_cache (tmp_path : Path , monkeypatch : pytest .MonkeyPatch ) -> None :
51+ def test_compute_file_hash_git_sha1_computes_hash (tmp_path : Path , monkeypatch : pytest .MonkeyPatch ) -> None :
5352 fp = tmp_path / "x.txt"
5453 data = b"cached!"
5554 _write (fp , data )
@@ -62,12 +61,12 @@ def fake_git_hash(b: bytes) -> str:
6261
6362 monkeypatch .setattr (verification_module , "git_hash" , fake_git_hash , raising = False )
6463
65- cache : dict [Path , str ] = {}
66- h1 = compute_file_hash (fp , "git-sha1" , git_hash_cache = cache )
67- h2 = compute_file_hash (fp , "git-sha1" , git_hash_cache = cache )
64+ h1 = compute_file_hash (fp , "git-sha1" )
65+ h2 = compute_file_hash (fp , "git-sha1" )
6866
6967 assert h1 == h2 == git_hash (data )
70- assert calls ["count" ] == 1
68+ # Each call computes the hash independently (no cache)
69+ assert calls ["count" ] == 2
7170
7271
7372def test_resolve_local_root_cache_single_snapshot (tmp_path : Path ) -> None :
@@ -104,11 +103,17 @@ def test_verify_maps_success_local_dir(tmp_path: Path) -> None:
104103 lfs = {"sha256" : hashlib .sha256 (b"bb" ).hexdigest ()},
105104 ),
106105 }
107- res = verify_maps (remote_by_path = remote_by_path , local_by_path = local_by_path , revision = "abc" )
106+ res = verify_maps (
107+ remote_by_path = remote_by_path ,
108+ local_by_path = local_by_path ,
109+ revision = "abc" ,
110+ verified_path = loc ,
111+ )
108112 assert res .checked_count == 2
109113 assert res .mismatches == []
110114 assert res .missing_paths == []
111115 assert res .extra_paths == []
116+ assert res .verified_path == loc
112117
113118
114119def test_verify_maps_reports_mismatch (tmp_path : Path ) -> None :
@@ -117,10 +122,16 @@ def test_verify_maps_reports_mismatch(tmp_path: Path) -> None:
117122 _write (loc / "a.txt" , b"wrong" )
118123 local_by_path = collect_local_files (loc )
119124 remote_by_path = {"a.txt" : SimpleNamespace (path = "a.txt" , blob_id = git_hash (b"right" ), lfs = None )}
120- res = verify_maps (remote_by_path = remote_by_path , local_by_path = local_by_path , revision = "r" )
125+ res = verify_maps (
126+ remote_by_path = remote_by_path ,
127+ local_by_path = local_by_path ,
128+ revision = "r" ,
129+ verified_path = loc ,
130+ )
121131 assert len (res .mismatches ) == 1
122132 m = res .mismatches [0 ]
123133 assert m ["path" ] == "a.txt" and m ["algorithm" ] == "git-sha1"
134+ assert res .verified_path == loc
124135
125136
126137def test_api_verify_repo_checksums_cache_mode (tmp_path : Path ) -> None :
0 commit comments