From 57ee910f37c4f8fb9d598252554eaa19e1cc7e12 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 04:57:25 +0200 Subject: [PATCH] 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. --- tests/test_manifest_entry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_manifest_entry.py b/tests/test_manifest_entry.py index ed0ce8f6..3505bbf2 100644 --- a/tests/test_manifest_entry.py +++ b/tests/test_manifest_entry.py @@ -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