fix: isolate the miscompute test from its cache

The test simulates a miscompute on a real held file. Since the
manifest hash cache is keyed by the expected sha1, a result another
test verified for the same file is a valid hit, and in a single
process run the simulated miscompute was never hashed. The class
starts from an empty cache.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 04:57:25 +02:00
1 parent 9a4228ae81
commit 57ee910f37
1 file changed
+6
+6
View File
@@ -41,6 +41,12 @@ class AnEntryWithoutSourceIsAnOmission(unittest.TestCase):
if held is None:
self.skipTest("no small indexed file on disk")
self.sha1, self.record = held
# Every case hashes the file anew through its own compute_hashes: a
# result another test verified for the same path and scan is a valid
# cache hit, and it skipped the miscompute this class simulates.
saved = dict(gp._STABLE_HASHES)
gp._STABLE_HASHES.clear()
self.addCleanup(gp._STABLE_HASHES.update, saved)
def _run_core_entries(self, hashes: dict) -> tuple[list, dict, list]:
name = Path(self.record["path"]).name