summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-05-07 15:17:33 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-05-07 15:33:47 -0700
commit56492de5b9bcc6f34a39617b4687283c18f76693 (patch)
treeca90e403761ce2b4bae076c5cc4b9204e8c4f1cb
parentaca275f58db0ce3da247b35588ebec563c7ba937 (diff)
downloadnode-56492de5b9bcc6f34a39617b4687283c18f76693.tar.gz
test: don't use total_seconds() because of py2.6
-rwxr-xr-xtools/test.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/test.py b/tools/test.py
index 90d39c811..c82d4acb4 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -31,7 +31,6 @@
import imp
import optparse
import os
-from os.path import join, dirname, abspath, basename, isdir, exists
import platform
import re
import signal
@@ -39,11 +38,13 @@ import subprocess
import sys
import tempfile
import time
-import datetime
import threading
-from Queue import Queue, Empty
import utils
+from os.path import join, dirname, abspath, basename, isdir, exists
+from datetime import datetime
+from Queue import Queue, Empty
+
VERBOSE = False
@@ -114,9 +115,9 @@ class ProgressIndicator(object):
self.AboutToRun(case)
self.lock.release()
try:
- start = datetime.datetime.now()
+ start = datetime.now()
output = case.Run()
- case.duration = (datetime.datetime.now() - start)
+ case.duration = (datetime.now() - start)
except IOError, e:
assert self.terminate
return
@@ -243,8 +244,12 @@ class TapProgressIndicator(SimpleProgressIndicator):
duration = output.test.duration
+ # total_seconds() was added in 2.7
+ total_seconds = (duration.microseconds +
+ (duration.seconds + duration.days * 24 * 3600) * 10**6) / 10**6
+
print ' ---'
- print ' duration_ms: %d.%d' % (duration.total_seconds(), duration.microseconds / 1000)
+ print ' duration_ms: %d.%d' % (total_seconds, duration.microseconds / 1000)
print ' ...'
def Done(self):