MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / test_find_next_unlabeled_folder

Function test_find_next_unlabeled_folder

tests/test_auxiliaryfunctions.py:199–224  ·  view source on GitHub ↗
(
    tmpdir_factory,
    monkeypatch,
    labeled_folders,
    next_folder_name,
)

Source from the content-addressed store, hash-verified

197 ],
198)
199def test_find_next_unlabeled_folder(
200 tmpdir_factory,
201 monkeypatch,
202 labeled_folders,
203 next_folder_name,
204):
205 project_folder = tmpdir_factory.mktemp("project")
206 fake_cfg = Path(project_folder / "cfg.yaml")
207 auxiliaryfunctions.write_config(fake_cfg, {"project_path": str(project_folder)})
208
209 data_folder = project_folder / "labeled-data"
210 data_folder.mkdir()
211 rglob_results = []
212 for has_h5, h5_last_mod_time, folder_name in labeled_folders:
213 labeled_folder_path = Path(data_folder / folder_name)
214 labeled_folder_path.mkdir()
215 if has_h5:
216 h5_path = Path(labeled_folder_path / "data.h5")
217 rglob_results.append(MockPath(h5_path, h5_last_mod_time))
218
219 def get_rglob_results(*args, **kwargs):
220 return rglob_results
221
222 monkeypatch.setattr(Path, "rglob", get_rglob_results)
223 next_folder = auxiliaryfunctions.find_next_unlabeled_folder(fake_cfg)
224 assert str(next_folder) == str(Path(data_folder / next_folder_name))
225
226
227@pytest.fixture

Callers

nothing calls this directly

Calls 2

MockPathClass · 0.85
write_configMethod · 0.45

Tested by

no test coverage detected