Skip to content

Commit 0be255f

Browse files
committed
filter_test_summaries
1 parent 81c3a15 commit 0be255f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/prepare_to_deploy.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import shutil
33
from pathlib import Path
4+
from typing import Any, Dict, List
45

56
import typer
67
from packaging.version import Version
@@ -17,6 +18,33 @@ def get_sub_summaries(path: Path):
1718
return [{k: v for k, v in sub.items() if k != "source_name"} for sub in subs]
1819

1920

21+
def filter_test_summaries(tests: Dict[str, List[Dict[str, Any]]]) -> Dict[str, List[Dict[str, Any]]]:
22+
assert "bioimageio" in tests
23+
unique_tests = set()
24+
ret = {}
25+
for partner in ["bioimageio", [p for p in tests if p != "bioimageio"]]: # process 'bioimageio' first
26+
for summary in tests[partner]:
27+
key = (
28+
summary.get("bioimageio_spec_version"),
29+
summary.get("bioimageio_core_version"),
30+
summary.get("name"),
31+
summary.get("status"),
32+
summary.get("error"),
33+
str(summary.get("warnings")),
34+
str(summary.get("nested_errors")),
35+
)
36+
if key in unique_tests:
37+
continue
38+
39+
unique_tests.add(key)
40+
if partner not in ret:
41+
ret[partner] = []
42+
43+
ret[partner].append(summary)
44+
45+
return ret
46+
47+
2048
def main(
2149
dist: Path = Path(__file__).parent / "../dist/gh_pages_update",
2250
collection: Path = Path(__file__).parent / "../collection",
@@ -128,6 +156,8 @@ def main(
128156
for sp in (partner_folder / krv.resource_id / krv.version_id).glob("*test_summary*.yaml"):
129157
test_summary["tests"][partner_id] += get_sub_summaries(sp)
130158

159+
test_summary["tests"] = filter_test_summaries(test_summary["tests"])
160+
131161
# write updated test summary
132162
if test_summary != previous_test_summary:
133163
updated_test_summary_path = dist / previous_test_summary_path.relative_to(gh_pages)

0 commit comments

Comments
 (0)