File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -133,13 +133,17 @@ class TestCmd(CmdBase, WithSource):
133
133
decimal : int = 4
134
134
"""Precision for numerical comparisons"""
135
135
136
+ summary_path : Optional [Path ] = None
137
+ """Path to save validation summary as JSON file."""
138
+
136
139
def run (self ):
137
140
sys .exit (
138
141
test (
139
142
self .descr ,
140
143
weight_format = self .weight_format ,
141
144
devices = self .devices ,
142
145
decimal = self .decimal ,
146
+ summary_path = self .summary_path ,
143
147
)
144
148
)
145
149
Original file line number Diff line number Diff line change 1
1
"""These functions implement the logic of the bioimageio command line interface
2
2
defined in `bioimageio.core.cli`."""
3
3
4
+ import json
4
5
from pathlib import Path
5
6
from typing import Optional , Sequence , Union
6
7
@@ -26,6 +27,7 @@ def test(
26
27
weight_format : WeightFormatArgAll = "all" ,
27
28
devices : Optional [Union [str , Sequence [str ]]] = None ,
28
29
decimal : int = 4 ,
30
+ summary_path : Optional [Path ] = None ,
29
31
) -> int :
30
32
"""test a bioimageio resource
31
33
@@ -35,6 +37,7 @@ def test(
35
37
weight_format: (model only) The weight format to use
36
38
devices: Device(s) to use for testing
37
39
decimal: Precision for numerical comparisons
40
+ summary_path: Path to save validation summary as JSON file.
38
41
"""
39
42
if isinstance (descr , InvalidDescr ):
40
43
descr .validation_summary .display ()
@@ -47,6 +50,9 @@ def test(
47
50
decimal = decimal ,
48
51
)
49
52
summary .display ()
53
+ if summary_path is not None :
54
+ _ = summary_path .write_text (summary .model_dump_json (indent = 4 ))
55
+
50
56
return 0 if summary .status == "passed" else 1
51
57
52
58
You can’t perform that action at this time.
0 commit comments