Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6ab2215

Browse filesBrowse files
MoLowdanielleadams
authored andcommitted
tools: fix duration_ms to be milliseconds
PR-URL: #44490 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Christian Clauss <cclauss@me.com>
1 parent 420deac commit 6ab2215
Copy full SHA for 6ab2215

File tree

Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+2-10Lines changed: 2 additions & 10 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.