From 74d69fedfb8c5bd55eb3629465dd907f77120c9e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 17 Nov 2026 02:40:20 +0100 Subject: [PATCH] Walk the test's mocked tree past a gzip and a link, killing the walk's break mutant --- bin/compress_archives/test_compress_archives.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/compress_archives/test_compress_archives.py b/bin/compress_archives/test_compress_archives.py index 3cfd54c1..ecfe7838 100644 --- a/bin/compress_archives/test_compress_archives.py +++ b/bin/compress_archives/test_compress_archives.py @@ -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):