Skip to content

Commit 46656d5

Browse files
authored
Merge pull request #2 from jeylau/temp_dir_test
Use pytest's temporary directories
2 parents 61515f9 + 88ace7e commit 46656d5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/test_modeldownload.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@
1111
import pytest
1212

1313

14-
def test_catdownload():
14+
def test_catdownload(tmp_path_factory):
1515
# TODO: just download the lightweight stuff..
1616
import dlclibrary, os
1717

18-
os.mkdir("cat")
19-
dlclibrary.download_hugginface_model("full_cat", "cat")
18+
folder = tmp_path_factory.mktemp("cat")
19+
dlclibrary.download_hugginface_model("full_cat", str(folder))
2020

21-
assert os.path.exists("cat/pose_cfg.yaml")
22-
assert os.path.exists("cat/snapshot-75000.meta")
23-
24-
import shutil
25-
26-
shutil.rmtree("cat")
21+
assert os.path.exists(folder / "pose_cfg.yaml")
22+
assert os.path.exists(folder / "snapshot-75000.meta")

0 commit comments

Comments
 (0)