Make the vanished-file test reach the stat it fails on, killing the walk's break mutant
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user