From 4a561b3158360f1d34c00be8de8f38d8cde6fb80 Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Sat, 9 Sep 2023 15:19:26 +0200 Subject: [PATCH 1/2] Fix test failures due to http rate limit --- cebra/helper.py | 2 +- tests/test_dlc.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cebra/helper.py b/cebra/helper.py index c4124169..b76fd93e 100644 --- a/cebra/helper.py +++ b/cebra/helper.py @@ -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 diff --git a/tests/test_dlc.py b/tests/test_dlc.py index a754d008..11f47fac 100644 --- a/tests/test_dlc.py +++ b/tests/test_dlc.py @@ -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"] @@ -166,7 +176,7 @@ def test_multianimal_dlc_file(): 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) From ab4f643ae80f92531cf495bf814bf2687f41b1e8 Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Sat, 9 Sep 2023 15:26:02 +0200 Subject: [PATCH 2/2] Fix default arg in download_file_from_zip_url --- tests/test_dlc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_dlc.py b/tests/test_dlc.py index 11f47fac..bbac1d89 100644 --- a/tests/test_dlc.py +++ b/tests/test_dlc.py @@ -169,7 +169,7 @@ 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)