-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced fast_fail with pqdm_kwargs the code and added a test
- Loading branch information
1 parent
87cd8fc
commit 374f303
Showing
3 changed files
with
58 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from unittest.mock import Mock | ||
|
||
import earthaccess | ||
import pytest | ||
|
||
|
||
def test_download(monkeypatch): | ||
earthaccess.login() | ||
|
||
results = earthaccess.search_data( | ||
short_name="ATL06", | ||
bounding_box=(-10, 20, 10, 50), | ||
temporal=("1999-02", "2019-03"), | ||
count=10, | ||
) | ||
|
||
def mock_get(*args, **kwargs): | ||
raise Exception("Download failed") | ||
|
||
mock_store = Mock() | ||
monkeypatch.setattr(earthaccess, "__store__", mock_store) | ||
monkeypatch.setattr(mock_store, "get", mock_get) | ||
|
||
with pytest.raises(Exception, match="Download failed"): | ||
earthaccess.download(results, "/home/download-folder") |