fix issue9 wrong XPass with failing setup/teardown function of xfail marked test
now when setup or teardown of a test item/function fails and the test is marked "xfail" it will show up as an xfail-ed test.
This commit is contained in:
@@ -308,6 +308,37 @@ class TestXFail:
|
||||
"*1 xfailed*",
|
||||
])
|
||||
|
||||
class TestXFailwithSetupTeardown:
|
||||
def test_failing_setup_issue9(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
def setup_function(func):
|
||||
assert 0
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 xfail*",
|
||||
])
|
||||
|
||||
def test_failing_teardown_issue9(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
def teardown_function(func):
|
||||
assert 0
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 xfail*",
|
||||
])
|
||||
|
||||
|
||||
class TestSkipif:
|
||||
def test_skipif_conditional(self, testdir):
|
||||
|
||||
Reference in New Issue
Block a user