Make the vanished-file test reach the stat it fails on, killing the walk's break mutant

This commit is contained in:
2026-11-17 02:16:18 +01:00
parent f0bd187cd7
commit abe30ab893
@@ -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])