Fix formatting of merged files

This commit is contained in:
Bruno Oliveira 2018-05-25 18:21:48 -03:00
parent 6f8547cc1a
commit 1b16d649f9
4 changed files with 22 additions and 17 deletions

View File

@ -233,7 +233,6 @@ class _NodeReporter(object):
)
self.write_captured_output(report)
def finalize(self):
data = self.to_xml().unicode(indent=0)
self.__dict__.clear()

View File

@ -1 +1 @@
Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail.
Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail.

View File

@ -504,7 +504,8 @@ class TestPython(object):
# assert "ValueError" in fnode.toxml()
def test_xfail_captures_output_once(self, testdir):
testdir.makepyfile("""
testdir.makepyfile(
"""
import sys
import pytest
@ -513,12 +514,13 @@ class TestPython(object):
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
assert len(tnode.find_by_tag("system-err")) == 1
assert len(tnode.find_by_tag("system-out")) == 1
def test_xfailure_xpass(self, testdir):
testdir.makepyfile(

View File

@ -928,15 +928,14 @@ def test_class_method_containing_test_issue1558(testdir):
@pytest.mark.issue(3498)
@pytest.mark.parametrize("base", [
'six.moves.builtins.object',
'unittest.TestCase',
'unittest2.TestCase',
])
@pytest.mark.parametrize(
"base", ["six.moves.builtins.object", "unittest.TestCase", "unittest2.TestCase"]
)
def test_usefixtures_marker_on_unittest(base, testdir):
module = base.rsplit('.', 1)[0]
module = base.rsplit(".", 1)[0]
pytest.importorskip(module)
testdir.makepyfile(conftest="""
testdir.makepyfile(
conftest="""
import pytest
@pytest.fixture(scope='function')
@ -961,9 +960,11 @@ def test_usefixtures_marker_on_unittest(base, testdir):
for item in items:
node_and_marks(item)
""")
"""
)
testdir.makepyfile("""
testdir.makepyfile(
"""
import pytest
import {module}
@ -982,7 +983,10 @@ def test_usefixtures_marker_on_unittest(base, testdir):
assert self.fixture2
""".format(module=module, base=base))
""".format(
module=module, base=base
)
)
result = testdir.runpytest('-s')
result = testdir.runpytest("-s")
result.assert_outcomes(passed=2)