Skip to content

Commit 564a06e

Browse files
committed
[LIT] Support metrics with string output
The README.md claims support for this, but it looks like that may have been broken.
1 parent 0f6ecee commit 564a06e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

litsupport/testplan.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@ def _executePlan(context, plan):
141141
continue
142142
try:
143143
value = lit.Test.toMetricValue(float(out))
144-
context.result_metrics[metric] = value
145144
except ValueError:
146145
logging.warning(
147-
"Metric reported for '%s' is not a float: '%s'", metric, out
146+
"Metric reported for '%s' is not a float: '%s', treating as JSON", metric, out
148147
)
148+
else:
149+
value = lit.Test.JSONMetricValue(out)
150+
finally:
151+
context.result_metrics[metric] = value
149152

150153
return lit.Test.PASS
151154

0 commit comments

Comments
 (0)