Skip to content

Commit 16653e2

Browse files
authored
Fix test failures due to http rate limit (#62)
* Fix test failures due to http rate limit * Fix default arg in download_file_from_zip_url
1 parent a21ba0e commit 16653e2

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

cebra/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def download_file_from_url(url: str) -> str:
4848
return filename
4949

5050

51-
def download_file_from_zip_url(url, file="montblanc_tracks.h5"):
51+
def download_file_from_zip_url(url, *, file):
5252
"""Directly extract files without writing the archive to disk."""
5353
with tempfile.TemporaryDirectory() as tf:
5454
foldername = tf

tests/test_dlc.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,19 @@
2020
from cebra import CEBRA
2121
from cebra import load_data
2222

23-
ANNOTATED_DLC_URL = "https://github.com/DeepLabCut/DeepLabCut/blob/main/examples/Reaching-Mackenzie-2018-08-30/labeled-data/reachingvideo1/CollectedData_Mackenzie.h5?raw=true"
23+
# NOTE(stes): The original data URL is
24+
# https://github.com/DeepLabCut/DeepLabCut/blob/main/examples
25+
# /Reaching-Mackenzie-2018-08-30/labeled-data/reachingvideo1
26+
# /CollectedData_Mackenzie.h5?raw=true
27+
# which is replaced here due to rate limitations we observed in the past.
28+
ANNOTATED_DLC_URL = "https://figshare.com/ndownloader/files/42303564?private_link=b917317bfab725e0b207"
29+
30+
# NOTE(stes): The original data URL is
31+
# https://github.com/DeepLabCut/UnitTestData/raw/main/data.zip")
32+
# which is replaced here due to rate limitations we observed in the past.
2433
MULTISESSION_PRED_DLC_URL = (
25-
"https://github.com/DeepLabCut/UnitTestData/raw/main/data.zip")
34+
"https://figshare.com/ndownloader/files/42303561?private_link=b917317bfab725e0b207"
35+
)
2636

2737
MULTISESSION_PRED_KEYPOINTS = ["head", "tail"]
2838
ANNOTATED_KEYPOINTS = ["Hand", "Tongue"]
@@ -159,14 +169,14 @@ def test_load_data_dlc_invalid_keypoints(filename, keypoints):
159169
### multi-animals
160170
def test_multianimal_dlc_file():
161171
filename = cebra.helper.download_file_from_zip_url(
162-
url=MULTISESSION_PRED_DLC_URL)
172+
url=MULTISESSION_PRED_DLC_URL, file="montblanc_tracks.h5")
163173
with pytest.raises(NotImplementedError, match="Multi-animals.*"):
164174
_ = cebra_dlc.load_deeplabcut(filename)
165175

166176

167177
def test_multianimal_data_dlc_file():
168178
filename = cebra.helper.download_file_from_zip_url(
169-
url=MULTISESSION_PRED_DLC_URL)
179+
url=MULTISESSION_PRED_DLC_URL, file="montblanc_tracks.h5")
170180
with pytest.raises(NotImplementedError, match="Multi-animals.*"):
171181
_ = load_data(filename)
172182

0 commit comments

Comments
 (0)