unify handling of reportcharacters across resultlog/junitxml plugins
--HG-- branch : trunk
This commit is contained in:
@@ -25,11 +25,17 @@ class TestPython:
|
||||
assert 0
|
||||
def test_skip():
|
||||
py.test.skip("")
|
||||
@py.test.mark.xfail
|
||||
def test_xfail():
|
||||
assert 0
|
||||
@py.test.mark.xfail
|
||||
def test_xpass():
|
||||
assert 1
|
||||
""")
|
||||
result, dom = runandparse(testdir)
|
||||
assert result.ret
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, errors=0, failures=1, skips=1, tests=2)
|
||||
assert_attr(node, errors=0, failures=1, skips=3, tests=2)
|
||||
|
||||
def test_setup_error(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
@@ -92,6 +98,43 @@ class TestPython:
|
||||
assert_attr(fnode, message="test failure")
|
||||
assert "ValueError" in fnode.toxml()
|
||||
|
||||
def test_xfailure_function(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import py
|
||||
def test_xfail():
|
||||
py.test.xfail("42")
|
||||
""")
|
||||
result, dom = runandparse(testdir)
|
||||
assert not result.ret
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, skips=1, tests=0)
|
||||
tnode = node.getElementsByTagName("testcase")[0]
|
||||
assert_attr(tnode,
|
||||
classname="test_xfailure_function.test_xfailure_function",
|
||||
name="test_xfail")
|
||||
fnode = tnode.getElementsByTagName("skipped")[0]
|
||||
assert_attr(fnode, message="expected test failure")
|
||||
#assert "ValueError" in fnode.toxml()
|
||||
|
||||
def test_xfailure_xpass(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import py
|
||||
@py.test.mark.xfail
|
||||
def test_xpass():
|
||||
pass
|
||||
""")
|
||||
result, dom = runandparse(testdir)
|
||||
#assert result.ret
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
assert_attr(node, skips=1, tests=0)
|
||||
tnode = node.getElementsByTagName("testcase")[0]
|
||||
assert_attr(tnode,
|
||||
classname="test_xfailure_xpass.test_xfailure_xpass",
|
||||
name="test_xpass")
|
||||
fnode = tnode.getElementsByTagName("skipped")[0]
|
||||
assert_attr(fnode, message="xfail-marked test passes unexpectedly")
|
||||
#assert "ValueError" in fnode.toxml()
|
||||
|
||||
def test_collect_error(self, testdir):
|
||||
testdir.makepyfile("syntax error")
|
||||
result, dom = runandparse(testdir)
|
||||
|
||||
@@ -126,7 +126,7 @@ class TestWithFunctionIntegration:
|
||||
tb = "".join(lines[8:14])
|
||||
assert tb.find('raise ValueError("XFAIL")') != -1
|
||||
|
||||
assert lines[14].startswith('P ')
|
||||
assert lines[14].startswith('X ')
|
||||
assert len(lines) == 15
|
||||
|
||||
def test_internal_exception(self):
|
||||
|
||||
@@ -162,7 +162,7 @@ class TestXFail:
|
||||
def test_that():
|
||||
assert 1
|
||||
""")
|
||||
result = testdir.runpytest(p, '-rP')
|
||||
result = testdir.runpytest(p, '-rX')
|
||||
result.stdout.fnmatch_lines([
|
||||
"*XPASS*test_that*",
|
||||
"*1 xpassed*"
|
||||
@@ -331,7 +331,7 @@ def test_reportchars(testdir):
|
||||
def test_4():
|
||||
py.test.skip("four")
|
||||
""")
|
||||
result = testdir.runpytest("-rfxPs")
|
||||
result = testdir.runpytest("-rfxXs")
|
||||
result.stdout.fnmatch_lines([
|
||||
"FAIL*test_1*",
|
||||
"XFAIL*test_2*",
|
||||
|
||||
Reference in New Issue
Block a user