@@ -22,9 +22,13 @@ def _handle_exists_request(work, request):
2222 return Path ._handle_exists_request (work , request )
2323
2424
25+ @mock .patch ("lightning_app.storage.path.pathlib.Path.is_dir" )
26+ @mock .patch ("lightning_app.storage.path.pathlib.Path.stat" )
2527@mock .patch ("lightning_app.storage.copier._filesystem" )
26- def test_copier_copies_all_files (fs_mock , tmpdir ):
28+ def test_copier_copies_all_files (fs_mock , stat_mock , dir_mock , tmpdir ):
2729 """Test that the Copier calls the copy with the information provided in the request."""
30+ stat_mock ().st_size = 0
31+ dir_mock .return_value = False
2832 copy_request_queue = _MockQueue ()
2933 copy_response_queue = _MockQueue ()
3034 work = mock .Mock ()
@@ -38,9 +42,13 @@ def test_copier_copies_all_files(fs_mock, tmpdir):
3842 fs_mock ().put .assert_called_once_with ("file" , tmpdir / ".shared" / "123" )
3943
4044
41- def test_copier_handles_exception (monkeypatch ):
45+ @mock .patch ("lightning_app.storage.path.pathlib.Path.is_dir" )
46+ @mock .patch ("lightning_app.storage.path.pathlib.Path.stat" )
47+ def test_copier_handles_exception (stat_mock , dir_mock , monkeypatch ):
4248 """Test that the Copier captures exceptions from the file copy and forwards them through the queue without
4349 raising it."""
50+ stat_mock ().st_size = 0
51+ dir_mock .return_value = False
4452 copy_request_queue = _MockQueue ()
4553 copy_response_queue = _MockQueue ()
4654 fs = mock .Mock ()
0 commit comments