File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ def _connect_first_suitable(
156
156
continue
157
157
success = True
158
158
yield connection
159
+ break # Do not try any more transfers.
159
160
if not success :
160
161
raise FileNotAccessibleError (
161
162
f"Unable to { action } files for dataset: "
Original file line number Diff line number Diff line change @@ -226,6 +226,29 @@ def test_select_download_uses_second_child_transfer_success(dataset: Dataset) ->
226
226
assert not transfer_2 .reverted
227
227
228
228
229
+ def test_select_download_does_not_keep_going_after_first_success (
230
+ dataset : Dataset ,
231
+ ) -> None :
232
+ transfer_1 = SuccessfulTransfer ()
233
+ transfer_2 = SuccessfulTransfer ()
234
+ transfer = SelectFileTransfer ([transfer_1 , transfer_2 ])
235
+
236
+ remote = dataset .source_folder / "file" # type: ignore[operator]
237
+ local = Path ("local_file" )
238
+ with transfer .connect_for_download (dataset , RemotePath ("file" )) as con :
239
+ con .download_files (remote = [remote ], local = [local ])
240
+
241
+ assert not transfer_1 .is_open_for_download
242
+ assert transfer_1 .downloaded == [(remote , local )]
243
+ assert not transfer_1 .uploaded
244
+ assert not transfer_1 .reverted
245
+
246
+ assert not transfer_2 .is_open_for_download
247
+ assert not transfer_2 .downloaded
248
+ assert not transfer_2 .uploaded
249
+ assert not transfer_2 .reverted
250
+
251
+
229
252
def test_select_upload_uses_single_child_transfer_success (dataset : Dataset ) -> None :
230
253
transfer_1 = SuccessfulTransfer ()
231
254
transfer = SelectFileTransfer ([transfer_1 ])
You can’t perform that action at this time.
0 commit comments