| import json | |
| from pathlib import Path | |
| from ylff.utils.dataset_layout import discover_capture_bundles, validate_paths_exist | |
| def test_discover_capture_bundles_finds_manifest_dirs(tmp_path: Path): | |
| b1 = tmp_path / "b1" | |
| b2 = tmp_path / "b2" | |
| b1.mkdir() | |
| b2.mkdir() | |
| (b1 / "manifest.json").write_text(json.dumps({"schema_version": "1.0", "capture_id": "x"})) | |
| (b2 / "manifest.json").write_text(json.dumps({"schema_version": "1.0", "capture_id": "y"})) | |
| found = discover_capture_bundles(tmp_path) | |
| assert found == [b1, b2] | |
| def test_validate_paths_exist_reports_missing(tmp_path: Path): | |
| (tmp_path / "exists.txt").write_text("ok") | |
| errors = validate_paths_exist(tmp_path, ["exists.txt", "missing.txt", None, ""]) | |
| assert any("missing.txt" in e for e in errors) | |
| assert not any("exists.txt" in e for e in errors) | |