Walk the test's mocked tree past a gzip and a link, killing the walk's break mutant

This commit is contained in:
2026-11-17 02:40:20 +01:00
parent eb64154384
commit 74d69fedfb
@@ -82,12 +82,16 @@ class Main(unittest.TestCase):
with mock.patch.object(main.time, "time", return_value=NOW):
self.assertEqual(self.run_main(now=None), (0, "Compressed 4 files.\n", ""))
def test_skips_a_file_removed_while_it_walks(self):
def test_walks_on_past_a_gzip_a_link_and_a_file_removed_while_it_walks(self):
gone = mock.Mock(**{"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"
packed = self.archive / "c.jsonl.gz"
packed.write_bytes(b"")
link = self.archive / "d.jsonl"
link.symlink_to(self.archive / "a.jsonl")
kept = self.archive / "a.jsonl"
root = mock.Mock(**{"rglob.return_value": [gone, kept]})
root = mock.Mock(**{"rglob.return_value": [packed, link, gone, kept]})
self.assertEqual(main.old_files(root, "*.jsonl", NOW), [kept])
def test_reads_the_archive_where_loop_claude_transcripts_puts_it(self):