Merge pull request #3499 from jeffreyrack/3491-junit-logging
3491 - Fixed a bug where stdout and stderr were logged twice by junitxml for xfail tests.
This commit is contained in:
		
						commit
						93fdad28aa
					
				|  | @ -0,0 +1 @@ | ||||||
|  | Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail. | ||||||
|  | @ -458,6 +458,23 @@ class TestPython(object): | ||||||
|         fnode.assert_attr(message="expected test failure") |         fnode.assert_attr(message="expected test failure") | ||||||
|         # assert "ValueError" in fnode.toxml() |         # assert "ValueError" in fnode.toxml() | ||||||
| 
 | 
 | ||||||
|  |     def test_xfail_captures_output_once(self, testdir): | ||||||
|  |         testdir.makepyfile(""" | ||||||
|  |             import sys | ||||||
|  |             import pytest | ||||||
|  | 
 | ||||||
|  |             @pytest.mark.xfail() | ||||||
|  |             def test_fail(): | ||||||
|  |                 sys.stdout.write('XFAIL This is stdout') | ||||||
|  |                 sys.stderr.write('XFAIL This is stderr') | ||||||
|  |                 assert 0 | ||||||
|  |         """) | ||||||
|  |         result, dom = runandparse(testdir) | ||||||
|  |         node = dom.find_first_by_tag("testsuite") | ||||||
|  |         tnode = node.find_first_by_tag("testcase") | ||||||
|  |         assert len(tnode.find_by_tag('system-err')) == 1 | ||||||
|  |         assert len(tnode.find_by_tag('system-out')) == 1 | ||||||
|  | 
 | ||||||
|     def test_xfailure_xpass(self, testdir): |     def test_xfailure_xpass(self, testdir): | ||||||
|         testdir.makepyfile(""" |         testdir.makepyfile(""" | ||||||
|             import pytest |             import pytest | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue