Fix broken test in test_skipping and add one for strict xfail
This commit is contained in:
parent
ea379e0e4f
commit
018197d72a
|
@ -145,7 +145,20 @@ class TestXFail:
|
||||||
def test_xfail_xpassed(self, testdir):
|
def test_xfail_xpassed(self, testdir):
|
||||||
item = testdir.getitem("""
|
item = testdir.getitem("""
|
||||||
import pytest
|
import pytest
|
||||||
@pytest.mark.xfail
|
@pytest.mark.xfail(reason="nope")
|
||||||
|
def test_func():
|
||||||
|
assert 1
|
||||||
|
""")
|
||||||
|
reports = runtestprotocol(item, log=False)
|
||||||
|
assert len(reports) == 3
|
||||||
|
callreport = reports[1]
|
||||||
|
assert callreport.passed
|
||||||
|
assert callreport.wasxfail == "nope"
|
||||||
|
|
||||||
|
def test_xfail_xpassed_strict(self, testdir):
|
||||||
|
item = testdir.getitem("""
|
||||||
|
import pytest
|
||||||
|
@pytest.mark.xfail(strict=True, reason="nope")
|
||||||
def test_func():
|
def test_func():
|
||||||
assert 1
|
assert 1
|
||||||
""")
|
""")
|
||||||
|
@ -153,7 +166,8 @@ class TestXFail:
|
||||||
assert len(reports) == 3
|
assert len(reports) == 3
|
||||||
callreport = reports[1]
|
callreport = reports[1]
|
||||||
assert callreport.failed
|
assert callreport.failed
|
||||||
assert callreport.wasxfail == ""
|
assert callreport.longrepr == "[XPASS(strict)] nope"
|
||||||
|
assert not hasattr(callreport, "wasxfail")
|
||||||
|
|
||||||
def test_xfail_run_anyway(self, testdir):
|
def test_xfail_run_anyway(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
Loading…
Reference in New Issue