[Verify] Set time precision to 3 digits (instead of 5) after dot

The time precision in reports for Rally scenarios is set to 3 digits
after the dot. So it would be nice to have the same time precision in
"verify" command to be consistent with Rally scenarios.

Change-Id: I379c36731c488411ace3e39b67b42fcffa6495fa
This commit is contained in:
Yaroslav Lobankov 2016-03-23 20:22:26 -05:00
parent d7ecd75b0c
commit 41378395fe
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ def total_seconds(td):
# https://docs.python.org/2/library/datetime.html#datetime.timedelta.total_seconds
s = (td.microseconds +
(td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10.0 ** 6
return "%.5f" % s
return "%.3f" % s
def preparse_input_args(func):
@ -136,7 +136,7 @@ class SubunitV2StreamResult(object):
"name": (test_id.split("[")[0]
if test_id.find("[") > -1
else test_id),
"time": 0.0}
"time": "%.3f" % 0}
if tags:
self._tests[test_id]["tags"] = tags
elif test_id in self._tests:

View File

@ -28,7 +28,7 @@ class SubunitParserTestCase(test.TestCase):
self.assertEqual({"skipped": 1,
"success": 2,
"time": "5.00732",
"time": "5.007",
"failures": 3,
"expected_failures": 0,
"tests": 7,
@ -42,7 +42,7 @@ class SubunitParserTestCase(test.TestCase):
self.assertSequenceEqual([skipped_test], skipped_tests.keys())
self.assertEqual(
{"status": "skip", "reason": "This should be skipped.",
"time": "0.00007", "name": skipped_test},
"time": "0.000", "name": skipped_test},
skipped_tests[skipped_test])
failed_tests = result.filter_tests("fail")
@ -56,7 +56,7 @@ class SubunitParserTestCase(test.TestCase):
RuntimeError: broken setUp method
"""
self.assertEqual({"status": "fail", "traceback": trace,
"time": "0.00005", "name": failed_test},
"time": "0.000", "name": failed_test},
failed_tests[failed_test])
def test_filter_results(self):