Skip to content

Commit af07b24

Browse files
committed
fix duration_ms to be milliseconds
1 parent f7896d4 commit af07b24

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tools/test.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_module(name, path):
6767

6868
from io import open
6969
from os.path import join, dirname, abspath, basename, isdir, exists
70-
from datetime import datetime
70+
from datetime import datetime, timedelta
7171
try:
7272
from queue import Queue, Empty # Python 3
7373
except ImportError:
@@ -395,16 +395,8 @@ def HasRun(self, output):
395395

396396

397397
duration = output.test.duration
398-
399-
# total_seconds() was added in 2.7
400-
total_seconds = (duration.microseconds +
401-
(duration.seconds + duration.days * 24 * 3600) * 10**6) / 10**6
402-
403-
# duration_ms is measured in seconds and is read as such by TAP parsers.
404-
# It should read as "duration including ms" rather than "duration in ms"
405398
logger.info(' ---')
406-
logger.info(' duration_ms: %d.%d' %
407-
(total_seconds, duration.microseconds / 1000))
399+
logger.info(' duration_ms: %.5f' % (duration / timedelta(milliseconds=1)))
408400
if self.severity != 'ok' or self.traceback != '':
409401
if output.HasTimedOut():
410402
self.traceback = 'timeout\n' + output.output.stdout + output.output.stderr

0 commit comments

Comments
 (0)