Visitar URL original
Harden path-handling after pathlib migration by deruyter92 · Pull Request #3421 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix test_auxiliary functions wrong type: tmpdir.LocalPath -> str or Path
  • Loading branch information
deruyter92 committed Jul 21, 2026
commit 0a9bbbcbb22f90b4635c960e678e5093e74549f6
7 changes: 5 additions & 2 deletions tests/test_auxiliaryfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from deeplabcut.utils.auxfun_videos import SUPPORTED_VIDEOS


def test_find_analyzed_data(tmpdir_factory):
@pytest.mark.parametrize("path_type", [str, Path])
def test_find_analyzed_data(tmpdir_factory, path_type):
fake_folder = tmpdir_factory.mktemp("videos")
SUPPORTED_VIDEOS = ["avi"]
len(SUPPORTED_VIDEOS)
Expand All @@ -26,7 +27,7 @@ def test_find_analyzed_data(tmpdir_factory):
WRONG_SCORER = "DLC_dlcrnetms5_multi_mouseApr11shuffle3_5"

def _create_fake_file(filename):
path = str(fake_folder.join(filename))
path = Path(fake_folder) / filename
with open(path, "w") as f:
f.write("")
return path
Expand All @@ -37,6 +38,8 @@ def _create_fake_file(filename):
_ = _create_fake_file(vname + SCORER + ".pickle")
_ = _create_fake_file(vname + SCORER + ".h5")

# Test for both str and Path types (convert from tmpdir.LocalPath object)
fake_folder = path_type(fake_folder)
for ind, ext in enumerate(SUPPORTED_VIDEOS):
# test if existing models are found:
assert auxiliaryfunctions.find_analyzed_data(fake_folder, "video" + str(ind), SCORER)
Expand Down
Loading