(tmp_path: Path)
| 17 | |
| 18 | |
| 19 | def test_crawl_sources(tmp_path: Path) -> None: |
| 20 | def setup_source(source_path: Path, test_id: int) -> None: |
| 21 | source_path.mkdir(parents=True) |
| 22 | (source_path / "metrics.csv").write_text( |
| 23 | f"""test_col_1, test_col_2 |
| 24 | {test_id}1, {test_id}2 |
| 25 | {test_id}3, {test_id}4 |
| 26 | """ |
| 27 | ) |
| 28 | (source_path / "metadata.json").write_text( |
| 29 | f"""{{ |
| 30 | "suite_name": "test", |
| 31 | "argv": [], |
| 32 | "user": "test_user", |
| 33 | "hostname": "test_host", |
| 34 | "timestamp": "20220808_085348.161698", |
| 35 | "py_ver": "3.10.0", |
| 36 | "tf_ver": "2.8.0", |
| 37 | "np_ver": "1.20.0", |
| 38 | "ram": 12, |
| 39 | "cpu_name": "Test CPU", |
| 40 | "cpu_count": 8, |
| 41 | "cpu_frequency": 14, |
| 42 | "gpu_names": ["Test GPU"], |
| 43 | "git_branch_name": "develop", |
| 44 | "git_commit": "1234", |
| 45 | "run_id": "test_id_{test_id}" |
| 46 | }} |
| 47 | """ |
| 48 | ) |
| 49 | |
| 50 | source1 = tmp_path / "source1" |
| 51 | source2 = tmp_path / "source2" |
| 52 | source21 = source2 / "source21" |
| 53 | source22 = source2 / "source22" |
| 54 | |
| 55 | setup_source(source1, 1) |
| 56 | setup_source(source21, 21) |
| 57 | setup_source(source22, 22) |
| 58 | |
| 59 | cycle = source22 / "cycle" |
| 60 | cycle.symlink_to("../..") |
| 61 | |
| 62 | metrics_df, metadata = _crawl_sources([source1, source2]) |
| 63 | assert len(metrics_df) == 6 |
| 64 | assert {"test_id_1", "test_id_21", "test_id_22"} == set(m.run_id for m in metadata) |
nothing calls this directly
no test coverage detected
searching dependent graphs…