-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from unittest.mock import patch | ||
|
||
from fairchem.core.scripts import download_large_files as dl_large | ||
|
||
|
||
@patch.object(dl_large, "urlretreive") | ||
def test_download_large_files(url_mock): | ||
def urlretrieve_mock(x, y): | ||
if not os.path.exists(os.path.dirname(y)): | ||
raise ValueError(f'The path to {y} does not exist. fairchem directory structure has changed,') | ||
url_mock.side_effect = urlretrieve_mock | ||
dl_large.main('ALL') | ||
raise ValueError( | ||
f"The path to {y} does not exist. fairchem directory structure has changed," | ||
) | ||
|
||
url_mock.side_effect = urlretrieve_mock | ||
dl_large.main("ALL") |