Skip to content

Commit 1220b05

Browse files
committed
Improved unit tests
1 parent bc7072c commit 1220b05

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/test_modeldownload.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,25 @@
1111
import dlclibrary
1212
import os
1313
import pytest
14+
from dlclibrary.dlcmodelzoo.modelzoo_download import MODELOPTIONS
1415

1516

16-
def test_download_huggingface_model(tmp_path_factory):
17-
folder = tmp_path_factory.mktemp("cat")
18-
dlclibrary.download_huggingface_model("full_cat", str(folder))
17+
def test_download_huggingface_model(tmp_path_factory, model="full_cat"):
18+
folder = tmp_path_factory.mktemp("temp")
19+
dlclibrary.download_huggingface_model(model, str(folder))
1920

2021
assert os.path.exists(folder / "pose_cfg.yaml")
21-
assert os.path.exists(folder / "snapshot-75000.meta")
22+
assert any(f.startswith("snapshot-") for f in os.listdir(folder))
2223
# Verify that the Hugging Face folder was removed
2324
assert not any(f.startswith("models--") for f in os.listdir(folder))
2425

2526

2627
def test_download_huggingface_wrong_model():
2728
with pytest.raises(ValueError):
2829
dlclibrary.download_huggingface_model("wrong_model_name")
30+
31+
32+
@pytest.mark.skip
33+
@pytest.mark.parametrize("model", MODELOPTIONS)
34+
def test_download_all_models(tmp_path_factory, model):
35+
test_download_huggingface_model(tmp_path_factory, model)

0 commit comments

Comments
 (0)