| Index: tools/telemetry/telemetry/unittest/gtest_unittest_results.py
|
| diff --git a/tools/telemetry/telemetry/unittest/gtest_unittest_results.py b/tools/telemetry/telemetry/unittest/gtest_unittest_results.py
|
| index 3a9fdc1b3a9d83d39871fa3324b84d0f44a1c7d7..f68cbd9b07a0f4983cff7b79d1f8540f682cefe7 100644
|
| --- a/tools/telemetry/telemetry/unittest/gtest_unittest_results.py
|
| +++ b/tools/telemetry/telemetry/unittest/gtest_unittest_results.py
|
| @@ -8,20 +8,11 @@
|
| import unittest
|
|
|
|
|
| -class GTestTestSuite(unittest.TestSuite):
|
| - def run(self, result): # pylint: disable=W0221
|
| - result.StartTestSuite(self)
|
| - result = super(GTestTestSuite, self).run(result)
|
| - result.StopTestSuite(self)
|
| - return result
|
| -
|
| -
|
| class GTestUnittestResults(unittest.TestResult):
|
| def __init__(self, output_stream):
|
| super(GTestUnittestResults, self).__init__()
|
| self._output_stream = output_stream
|
| - self._test_start_time = None
|
| - self._test_suite_start_time = None
|
| + self._timestamp = None
|
| self._successes_count = 0
|
|
|
| @property
|
| @@ -29,7 +20,7 @@
|
| return self._successes_count
|
|
|
| def _GetMs(self):
|
| - return (time.time() - self._test_start_time) * 1000
|
| + return (time.time() - self._timestamp) * 1000
|
|
|
| @property
|
| def num_errors(self):
|
| @@ -60,7 +51,7 @@
|
| print >> self._output_stream, '[ RUN ]', (
|
| GTestUnittestResults._formatTestname(test))
|
| sys.stdout.flush()
|
| - self._test_start_time = time.time()
|
| + self._timestamp = time.time()
|
|
|
| def addSuccess(self, test):
|
| super(GTestUnittestResults, self).addSuccess(test)
|
| @@ -74,30 +65,11 @@
|
| super(GTestUnittestResults, self).addSkip(test, reason)
|
| test_name = GTestUnittestResults._formatTestname(test)
|
| logging.warning('===== SKIPPING TEST %s: %s =====', test_name, reason)
|
| - if self._test_start_time == None:
|
| - self._test_start_time = time.time()
|
| + if self._timestamp == None:
|
| + self._timestamp = time.time()
|
| print >> self._output_stream, '[ OK ]', test_name, (
|
| '(%0.f ms)' % self._GetMs())
|
| sys.stdout.flush()
|
| -
|
| - def StartTestSuite(self, suite):
|
| - contains_test_suites = any(isinstance(test, unittest.TestSuite)
|
| - for test in suite)
|
| - if not contains_test_suites:
|
| - test_count = len([test for test in suite])
|
| - unit = 'test' if test_count == 1 else 'tests'
|
| - print '[----------]', test_count, unit
|
| - self._test_suite_start_time = time.time()
|
| -
|
| - def StopTestSuite(self, suite):
|
| - contains_test_suites = any(isinstance(test, unittest.TestSuite)
|
| - for test in suite)
|
| - if not contains_test_suites:
|
| - elapsed_ms = (time.time() - self._test_suite_start_time) * 1000
|
| - test_count = len([test for test in suite])
|
| - unit = 'test' if test_count == 1 else 'tests'
|
| - print '[----------]', test_count, unit, '(%d ms total)' % elapsed_ms
|
| - print
|
|
|
| def PrintSummary(self):
|
| unit = 'test' if self._successes_count == 1 else 'tests'
|
|
|