Skip to content

Commit f40b498

Browse files
Add test and add to changelog. Open-EO/openeo-geopyspark-driver#877
1 parent 0d4caba commit f40b498

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- `MultiBackendJobManager`: Fix issue with duplicate job starting across multiple backends ([#654](https://github.com/Open-EO/openeo-python-client/pull/654))
2121
- `MultiBackendJobManager`: Fix encoding issue of job metadata in `on_job_done` ([#657](https://github.com/Open-EO/openeo-python-client/issues/657))
2222
- `MultiBackendJobManager`: Avoid `SettingWithCopyWarning` ([#641](https://github.com/Open-EO/openeo-python-client/issues/641))
23+
- Avoid creating empty file if asset download request failed.
2324

2425

2526
## [0.34.0] - 2024-10-31

tests/rest/test_job.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,24 @@ def test_result_asset_download_file(con100, requests_mock, tmp_path):
606606
assert f.read() == TIFF_CONTENT
607607

608608

609+
def test_result_asset_download_file_error(con100, requests_mock, tmp_path):
610+
href = API_URL + "/dl/jjr1.tiff"
611+
requests_mock.get(href, content=TIFF_CONTENT)
612+
href_404 = API_URL + "/dl/non-existing-url.tiff"
613+
614+
job = BatchJob("jj", connection=con100)
615+
asset = ResultAsset(job, name="1.tiff", href=href_404, metadata={"type": "image/tiff; application=geotiff"})
616+
target = tmp_path / "res.tiff"
617+
path = target
618+
# noinspection PyBroadException
619+
try:
620+
path = asset.download(target)
621+
except:
622+
pass
623+
assert not target.exists()
624+
assert not path.exists()
625+
626+
609627
def test_result_asset_download_folder(con100, requests_mock, tmp_path):
610628
href = API_URL + "/dl/jjr1.tiff"
611629
requests_mock.get(href, content=TIFF_CONTENT)

0 commit comments

Comments
 (0)