Chromium Code Reviews| Index: build/android/pylib/base/base_test_result.py |
| diff --git a/build/android/pylib/base/base_test_result.py b/build/android/pylib/base/base_test_result.py |
| index ebf9e71ef01b063d033ac1d693e8cf92ffe4465d..5228200ffae176b68eeb86a24168d25210fefa86 100644 |
| --- a/build/android/pylib/base/base_test_result.py |
| +++ b/build/android/pylib/base/base_test_result.py |
| @@ -22,7 +22,7 @@ class ResultType(object): |
| class BaseTestResult(object): |
| """Base class for a single test result.""" |
| - def __init__(self, name, test_type, log=''): |
| + def __init__(self, name, test_type, tag='', log=''): |
|
frankf
2013/07/17 04:07:20
Why all this complexity? Just update the name usin
gkanwar
2013/07/17 20:31:26
We can't make this object mutable, since it will b
|
| """Construct a BaseTestResult. |
| Args: |
| @@ -34,20 +34,28 @@ class BaseTestResult(object): |
| assert test_type in ResultType.GetTypes() |
| self._name = name |
| self._test_type = test_type |
| + self._tag = tag |
| self._log = log |
| def __str__(self): |
| - return self._name |
| + return self.GetTaggedName() |
| def __repr__(self): |
| - return self._name |
| + return self.GetTaggedName() |
| def __cmp__(self, other): |
| # pylint: disable=W0212 |
| - return cmp(self._name, other._name) |
| + return cmp(self.GetTaggedName(), other.GetTaggedName()) |
| def __hash__(self): |
| - return hash(self._name) |
| + return hash(self.GetTaggedName()) |
| + |
| + def GetTaggedName(self): |
| + """Get the test name with tag.""" |
| + if self._tag: |
| + return '%s_%s' % (self._tag, self._name) |
| + else: |
| + return self._name |
| def GetName(self): |
| """Get the test name.""" |
| @@ -57,10 +65,18 @@ class BaseTestResult(object): |
| """Get the test result type.""" |
| return self._test_type |
| + def GetTag(self): |
| + """Get the test tag.""" |
| + return self._tag |
| + |
| def GetLog(self): |
| """Get the test log.""" |
| return self._log |
| + def SetTag(self, tag): |
| + """Set the test tag.""" |
| + self._tag = tag |
| + |
| class TestRunResults(object): |
| """Set of results for a test run.""" |