Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures due to http rate limit #62

Merged
merged 2 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cebra/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def download_file_from_url(url: str) -> str:
return filename


def download_file_from_zip_url(url, file="montblanc_tracks.h5"):
def download_file_from_zip_url(url, *, file):
"""Directly extract files without writing the archive to disk."""
with tempfile.TemporaryDirectory() as tf:
foldername = tf
Expand Down
18 changes: 14 additions & 4 deletions tests/test_dlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@
from cebra import CEBRA
from cebra import load_data

ANNOTATED_DLC_URL = "https://github.com/DeepLabCut/DeepLabCut/blob/main/examples/Reaching-Mackenzie-2018-08-30/labeled-data/reachingvideo1/CollectedData_Mackenzie.h5?raw=true"
# NOTE(stes): The original data URL is
# https://github.com/DeepLabCut/DeepLabCut/blob/main/examples
# /Reaching-Mackenzie-2018-08-30/labeled-data/reachingvideo1
# /CollectedData_Mackenzie.h5?raw=true
# which is replaced here due to rate limitations we observed in the past.
ANNOTATED_DLC_URL = "https://figshare.com/ndownloader/files/42303564?private_link=b917317bfab725e0b207"

# NOTE(stes): The original data URL is
# https://github.com/DeepLabCut/UnitTestData/raw/main/data.zip")
# which is replaced here due to rate limitations we observed in the past.
MULTISESSION_PRED_DLC_URL = (
"https://github.com/DeepLabCut/UnitTestData/raw/main/data.zip")
"https://figshare.com/ndownloader/files/42303561?private_link=b917317bfab725e0b207"
)

MULTISESSION_PRED_KEYPOINTS = ["head", "tail"]
ANNOTATED_KEYPOINTS = ["Hand", "Tongue"]
Expand Down Expand Up @@ -159,14 +169,14 @@ def test_load_data_dlc_invalid_keypoints(filename, keypoints):
### multi-animals
def test_multianimal_dlc_file():
filename = cebra.helper.download_file_from_zip_url(
url=MULTISESSION_PRED_DLC_URL)
url=MULTISESSION_PRED_DLC_URL, file="montblanc_tracks.h5")
with pytest.raises(NotImplementedError, match="Multi-animals.*"):
_ = cebra_dlc.load_deeplabcut(filename)


def test_multianimal_data_dlc_file():
filename = cebra.helper.download_file_from_zip_url(
url=MULTISESSION_PRED_DLC_URL)
url=MULTISESSION_PRED_DLC_URL, file="montblanc_tracks.h5")
with pytest.raises(NotImplementedError, match="Multi-animals.*"):
_ = load_data(filename)

Expand Down
Loading