From abe30ab893fe6e38d8e5feace8f392ce6e640ee9 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 17 Nov 2026 02:16:18 +0100 Subject: [PATCH] Make the vanished-file test reach the stat it fails on, killing the walk's break mutant --- bin/compress_archives/test_compress_archives.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/compress_archives/test_compress_archives.py b/bin/compress_archives/test_compress_archives.py index 34823f6c..34e60177 100644 --- a/bin/compress_archives/test_compress_archives.py +++ b/bin/compress_archives/test_compress_archives.py @@ -77,7 +77,9 @@ class Main(unittest.TestCase): self.assertEqual(self.run_main(now=None), (0, "Compressed 4 files.\n", "")) def test_skips_a_file_removed_while_it_walks(self): - gone = mock.Mock(**{"name": "gone.jsonl", "is_file.return_value": True, "is_symlink.return_value": False, "stat.side_effect": FileNotFoundError}) + gone = mock.Mock(**{"is_file.return_value": True, "is_symlink.return_value": False, "stat.side_effect": FileNotFoundError}) + # Mock(name=...) names the mock itself, so the path's name is set after. + gone.name = "gone.jsonl" kept = self.archive / "a.jsonl" root = mock.Mock(**{"rglob.return_value": [gone, kept]}) self.assertEqual(main.old_files(root, "*.jsonl", NOW), [kept])