aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-09-05 12:10:29 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2020-09-05 12:53:15 +0200
commitede0ae51e07278b3d985cac1e32605f2977e18ed (patch)
treed4a3750fe9f38591f6729a09403603723d9c8c74
parent80438763cd13f079c5120ade81f4ebd5650ef861 (diff)
Fix duration calculation
It falsy printed 00:60 Change-Id: Ib2852268a6833b353232c80e9013b6926058479c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 242696fe51c7dc3530587350550ab07164706e56)
-rw-r--r--xtesting/core/testcase.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index f72cd377..131d8156 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -107,8 +107,9 @@ class TestCase(object):
assert self.stop_time
if self.stop_time < self.start_time:
return "XX:XX"
- return "{0[0]:02.0f}:{0[1]:02.0f}".format(divmod(
- self.stop_time - self.start_time, 60))
+ return "{}:{}".format(
+ str(int(self.stop_time - self.start_time) // 60).zfill(2),
+ str(int(self.stop_time - self.start_time) % 60).zfill(2))
except Exception: # pylint: disable=broad-except
self.__logger.error("Please run test before getting the duration")
return "XX:XX"