make "--runxfail" turn imperative pytest.xfail calls into no ops

(it already did neutralize pytest.mark.xfail markers)
This commit is contained in:
holger krekel
2013-10-09 22:55:20 +02:00
parent 0335c6d750
commit a5d4c20905
4 changed files with 34 additions and 23 deletions
+8 -10
View File
@@ -159,13 +159,14 @@ class TestXFail:
@pytest.mark.xfail
def test_func():
assert 0
def test_func2():
pytest.xfail("hello")
""")
result = testdir.runpytest("--runxfail")
assert result.ret == 1
result.stdout.fnmatch_lines([
"*def test_func():*",
"*assert 0*",
"*1 failed*",
"*1 failed*1 pass*",
])
def test_xfail_evalfalse_but_fails(self, testdir):
@@ -261,10 +262,7 @@ class TestXFail:
"*reason:*hello*",
])
result = testdir.runpytest(p, "--runxfail")
result.stdout.fnmatch_lines([
"*def test_this():*",
"*pytest.xfail*",
])
result.stdout.fnmatch_lines("*1 pass*")
def test_xfail_imperative_in_setup_function(self, testdir):
p = testdir.makepyfile("""
@@ -285,10 +283,10 @@ class TestXFail:
"*reason:*hello*",
])
result = testdir.runpytest(p, "--runxfail")
result.stdout.fnmatch_lines([
"*def setup_function(function):*",
"*pytest.xfail*",
])
result.stdout.fnmatch_lines("""
*def test_this*
*1 fail*
""")
def xtest_dynamic_xfail_set_during_setup(self, testdir):
p = testdir.makepyfile("""