Fix test in test_junitxml and add one for strict
This commit is contained in:
parent
55ec1d7f56
commit
ea379e0e4f
|
@ -325,16 +325,33 @@ class TestPython:
|
||||||
result, dom = runandparse(testdir)
|
result, dom = runandparse(testdir)
|
||||||
# assert result.ret
|
# assert result.ret
|
||||||
node = dom.find_first_by_tag("testsuite")
|
node = dom.find_first_by_tag("testsuite")
|
||||||
node.assert_attr(skips=1, tests=1)
|
node.assert_attr(skips=0, tests=1)
|
||||||
tnode = node.find_first_by_tag("testcase")
|
tnode = node.find_first_by_tag("testcase")
|
||||||
tnode.assert_attr(
|
tnode.assert_attr(
|
||||||
file="test_xfailure_xpass.py",
|
file="test_xfailure_xpass.py",
|
||||||
line="1",
|
line="1",
|
||||||
classname="test_xfailure_xpass",
|
classname="test_xfailure_xpass",
|
||||||
name="test_xpass")
|
name="test_xpass")
|
||||||
fnode = tnode.find_first_by_tag("skipped")
|
|
||||||
fnode.assert_attr(message="xfail-marked test passes unexpectedly")
|
def test_xfailure_xpass_strict(self, testdir):
|
||||||
# assert "ValueError" in fnode.toxml()
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
@pytest.mark.xfail(strict=True, reason="This needs to fail!")
|
||||||
|
def test_xpass():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result, dom = runandparse(testdir)
|
||||||
|
# assert result.ret
|
||||||
|
node = dom.find_first_by_tag("testsuite")
|
||||||
|
node.assert_attr(skips=0, tests=1)
|
||||||
|
tnode = node.find_first_by_tag("testcase")
|
||||||
|
tnode.assert_attr(
|
||||||
|
file="test_xfailure_xpass_strict.py",
|
||||||
|
line="1",
|
||||||
|
classname="test_xfailure_xpass_strict",
|
||||||
|
name="test_xpass")
|
||||||
|
fnode = tnode.find_first_by_tag("failure")
|
||||||
|
fnode.assert_attr(message="[XPASS(strict)] This needs to fail!")
|
||||||
|
|
||||||
def test_collect_error(self, testdir):
|
def test_collect_error(self, testdir):
|
||||||
testdir.makepyfile("syntax error")
|
testdir.makepyfile("syntax error")
|
||||||
|
|
Loading…
Reference in New Issue