Skip to content

Commit fa4af19

Browse files
committed
more accurate simulation
1 parent 5f72cf5 commit fa4af19

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/unit/test_put_get.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,16 @@ def _setup_test_for_reraise_file_transfer_work_fn_error(tmp_path, reraise_param_
406406
# Create a custom exception to be raised by the work function
407407
test_exception = Exception("Test work function failure")
408408

409+
def mock_upload_chunk_with_delay(*args, **kwargs):
410+
import time
411+
412+
time.sleep(0.2)
413+
raise test_exception
414+
409415
# Set up mock client patch, which we will activate in each unit test case.
410416
mock_create_client = mock.patch.object(agent, "_create_file_transfer_client")
411417
mock_client = mock.MagicMock()
412-
mock_client.prepare_upload.side_effect = test_exception
418+
mock_client.upload_chunk.side_effect = mock_upload_chunk_with_delay
413419

414420
# Set up mock client attributes needed for the transfer flow
415421
mock_client.meta = agent._file_metadata[0]

0 commit comments

Comments
 (0)