From c74eaa4b6450b9024806f05122f8fa57357c0f0d Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Tue, 2 Jul 2019 10:44:55 +0300 Subject: [PATCH] Fix absence of time attribute if test takes zero time (as result of rounding, for example) Signed-off-by: Yaroslav Brustinov --- junit_xml/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junit_xml/__init__.py b/junit_xml/__init__.py index 91838df..f16937a 100644 --- a/junit_xml/__init__.py +++ b/junit_xml/__init__.py @@ -168,7 +168,7 @@ def build_xml_doc(self, encoding=None): if case.assertions: # Number of assertions in the test case test_case_attributes['assertions'] = "%d" % case.assertions - if case.elapsed_sec: + if case.elapsed_sec is not None: test_case_attributes['time'] = "%f" % case.elapsed_sec if case.timestamp: test_case_attributes['timestamp'] = decode(case.timestamp, encoding)