Skip to content

Commit 03b6650

Browse files
MoLowRafaelGSS
authored andcommitted
tools: fix duration_ms to be milliseconds
PR-URL: #44490 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Christian Clauss <[email protected]>
1 parent 2a6c23e commit 03b6650

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
@@ -69,7 +69,7 @@ def get_module(name, path):
6969

7070
from io import open
7171
from os.path import join, dirname, abspath, basename, isdir, exists
72-
from datetime import datetime
72+
from datetime import datetime, timedelta
7373
try:
7474
from queue import Queue, Empty # Python 3
7575
except ImportError:
@@ -400,16 +400,8 @@ def HasRun(self, output):
400400

401401

402402
duration = output.test.duration
403-
404-
# total_seconds() was added in 2.7
405-
total_seconds = (duration.microseconds +
406-
(duration.seconds + duration.days * 24 * 3600) * 10**6) / 10**6
407-
408-
# duration_ms is measured in seconds and is read as such by TAP parsers.
409-
# It should read as "duration including ms" rather than "duration in ms"
410403
logger.info(' ---')
411-
logger.info(' duration_ms: %d.%d' %
412-
(total_seconds, duration.microseconds / 1000))
404+
logger.info(' duration_ms: %.5f' % (duration / timedelta(milliseconds=1)))
413405
if self.severity != 'ok' or self.traceback != '':
414406
if output.HasTimedOut():
415407
self.traceback = 'timeout\n' + output.output.stdout + output.output.stderr

0 commit comments

Comments
 (0)