summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-07 17:54:57 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-07 21:58:32 +0200
commit2cf3585e52807eedfe80bffcd56fd6df4eec467b (patch)
tree5f435b9cf32218d6d0bc1a07b8a9870d2e0bc120
parentbaf81a0e08099dc863a014eb6e03b6e877ae8b93 (diff)
downloadsamba-2cf3585e52807eedfe80bffcd56fd6df4eec467b.tar.gz
samba-2cf3585e52807eedfe80bffcd56fd6df4eec467b.tar.bz2
samba-2cf3585e52807eedfe80bffcd56fd6df4eec467b.zip
selftest: Display minutes and hours for duration.
-rwxr-xr-xselftest/format-subunit14
1 files changed, 13 insertions, 1 deletions
diff --git a/selftest/format-subunit b/selftest/format-subunit
index 54949df97a..032b990f2d 100755
--- a/selftest/format-subunit
+++ b/selftest/format-subunit
@@ -15,6 +15,18 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools"))
import subunithelper
import subunit
+def format_time(t):
+ minutes, seconds = divmod(t, 60)
+ hours, minutes = divmod(minutes, 60)
+ ret = ""
+ if hours:
+ ret += "%dh" % hours
+ if minutes:
+ ret += "%dm" % minutes
+ ret += "%ds" % seconds
+ return ret
+
+
class PlainFormatter(object):
def __init__(self, summaryfile, verbose, immediate, statistics,
@@ -62,7 +74,7 @@ class PlainFormatter(object):
out = "[%d" % self.index
if self.totalsuites is not None:
out += "/%d" % self.totalsuites
- out += " in %ds" % duration
+ out += " in " + format_time(duration)
if self.suitesfailed:
out += ", %d errors" % (len(self.suitesfailed),)
out += "] %s" % name