Index: utils/lit/lit/Test.py =================================================================== --- utils/lit/lit/Test.py +++ utils/lit/lit/Test.py @@ -1,6 +1,10 @@ import os from xml.sax.saxutils import escape from json import JSONEncoder +try: + basestring +except NameError: + basestring = str # python3 compatibility # Test result codes. @@ -76,6 +80,16 @@ def todata(self): return self.value +class StringMetricValue(MetricValue): + def __init__(self, value): + self.value = value + + def format(self): + return self.value + + def todata(self): + return self.value + class JSONMetricValue(MetricValue): """ JSONMetricValue is used for types that are representable in the output @@ -106,6 +120,8 @@ return IntMetricValue(value) elif isinstance(value, float): return RealMetricValue(value) + elif isinstance(value, basestring): + return StringMetricValue(value) else: # Try to create a JSONMetricValue and let the constructor throw # if value is not a valid type.