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])