From 0d07b645713d4a68acc651ba99ea9efc5d3f0307 Mon Sep 17 00:00:00 2001 From: John Towler Date: Wed, 4 May 2016 13:36:27 -0700 Subject: [PATCH] Fixes Issue 1549 --- AUTHORS | 1 + _pytest/junitxml.py | 2 +- testing/test_junitxml.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 7ae2b50d9..f4a21b22d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -49,6 +49,7 @@ Jaap Broekhuizen Jan Balster Janne Vanhala Jason R. Coombs +John Towler Joshua Bronson Jurko Gospodnetić Katarzyna Jachim diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 660d718a6..f4de1343e 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -369,7 +369,7 @@ class LogXML(object): suite_stop_time = time.time() suite_time_delta = suite_stop_time - self.suite_start_time - numtests = self.stats['passed'] + self.stats['failure'] + numtests = self.stats['passed'] + self.stats['failure'] + self.stats['skipped'] logfile.write('') logfile.write(Junit.testsuite( diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 5960f8825..a4f10dec5 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -100,7 +100,7 @@ class TestPython: result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=2) + node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=5) def test_timing_function(self, testdir): testdir.makepyfile(""" @@ -304,7 +304,7 @@ class TestPython: result, dom = runandparse(testdir) assert not result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_xfailure_function.py", @@ -325,7 +325,7 @@ class TestPython: result, dom = runandparse(testdir) # assert result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_xfailure_xpass.py", @@ -356,7 +356,7 @@ class TestPython: result, dom = runandparse(testdir) assert result.ret == EXIT_NOTESTSCOLLECTED node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_collect_skipped.py",