|
| 1 | +from nucleus.job import JobError |
1 | 2 | import pytest |
2 | 3 | import os |
3 | 4 |
|
@@ -155,6 +156,46 @@ def test_dataset_append_async(dataset: Dataset): |
155 | 156 | } |
156 | 157 |
|
157 | 158 |
|
| 159 | +def test_dataset_append_async_with_local_path(dataset: Dataset): |
| 160 | + ds_items = make_dataset_items() |
| 161 | + ds_items[ |
| 162 | + 0 |
| 163 | + ].image_location = "/a/fake/local/path/you/can/tell/is/local/but/is/fake" |
| 164 | + with pytest.raises(ValueError): |
| 165 | + dataset.append(ds_items, asynchronous=True) |
| 166 | + |
| 167 | + |
| 168 | +def test_dataset_append_async_with_1_bad_url(dataset: Dataset): |
| 169 | + ds_items = make_dataset_items() |
| 170 | + ds_items[0].image_location = "https://looks.ok.but.is.not.accessible" |
| 171 | + job = dataset.append(ds_items, asynchronous=True) |
| 172 | + with pytest.raises(JobError): |
| 173 | + job.sleep_until_complete() |
| 174 | + assert job.status() == { |
| 175 | + "job_id": f"{job.id}", |
| 176 | + "status": "Errored", |
| 177 | + "message": { |
| 178 | + "final_error": ( |
| 179 | + "One or more of the images you attempted to upload did not process" |
| 180 | + " correctly. Please see the status for an overview and the errors for " |
| 181 | + "more detailed messages." |
| 182 | + ), |
| 183 | + "image_upload_step": {"errored": 1, "pending": 0, "completed": 4}, |
| 184 | + "ingest_to_reupload_queue": { |
| 185 | + "epoch": 1, |
| 186 | + "total": 5, |
| 187 | + "datasetId": f"{dataset.id}", |
| 188 | + "processed": 5, |
| 189 | + }, |
| 190 | + "started_image_processing": f"Dataset: {dataset.id}, Job: {job.id}", |
| 191 | + }, |
| 192 | + } |
| 193 | + assert job.errors() == [ |
| 194 | + "One or more of the images you attempted to upload did not process correctly. Please see the status for an overview and the errors for more detailed messages.", |
| 195 | + 'Failure when processing the image "https://looks.ok.but.is.not.accessible": {}', |
| 196 | + ] |
| 197 | + |
| 198 | + |
158 | 199 | def test_dataset_list_autotags(CLIENT, dataset): |
159 | 200 | # Creation |
160 | 201 | # List of Autotags should be empty |
|
0 commit comments