Skip to content

Commit 595dc54

Browse files
authored
[LIT] Support metrics with string output (#228)
The README.md claims support for this, but it looks like that may have been broken.
1 parent 0f6ecee commit 595dc54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

litsupport/testplan.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ 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+
value = lit.Test.JSONMetricValue(out)
149+
finally:
150+
context.result_metrics[metric] = value
149151

150152
return lit.Test.PASS
151153

0 commit comments

Comments
 (0)