Skip to content

Commit 08e1a2d

Browse files
authored
Merge pull request #533 from bioimage-io/filter_test_summaries
filter_test_summaries
2 parents 81c3a15 + c45d078 commit 08e1a2d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

scripts/prepare_to_deploy.py

Lines changed: 34 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,37 @@ 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+
unique_tests = set()
23+
ret = {}
24+
for partner in ["bioimageio"] + [p for p in tests if p != "bioimageio"]: # process 'bioimageio' first
25+
for summary in tests.get(partner, []):
26+
key = tuple(
27+
[
28+
str(summary.get(k))
29+
for k in (
30+
"bioimageio_spec_version",
31+
"bioimageio_core_version",
32+
"name",
33+
"status",
34+
"error",
35+
"warnings",
36+
"nested_errors",
37+
)
38+
]
39+
)
40+
if key in unique_tests:
41+
continue
42+
43+
unique_tests.add(key)
44+
if partner not in ret:
45+
ret[partner] = []
46+
47+
ret[partner].append(summary)
48+
49+
return ret
50+
51+
2052
def main(
2153
dist: Path = Path(__file__).parent / "../dist/gh_pages_update",
2254
collection: Path = Path(__file__).parent / "../collection",
@@ -128,6 +160,8 @@ def main(
128160
for sp in (partner_folder / krv.resource_id / krv.version_id).glob("*test_summary*.yaml"):
129161
test_summary["tests"][partner_id] += get_sub_summaries(sp)
130162

163+
test_summary["tests"] = filter_test_summaries(test_summary["tests"])
164+
131165
# write updated test summary
132166
if test_summary != previous_test_summary:
133167
updated_test_summary_path = dist / previous_test_summary_path.relative_to(gh_pages)

0 commit comments

Comments
 (0)