when --runxfail is supplied also show tracebacks when running a test that

calls py.test.xfail

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-05-22 17:08:49 +02:00
parent 29a5b7452e
commit fa074da5a9
2 changed files with 16 additions and 5 deletions

View File

@ -218,11 +218,12 @@ def pytest_runtest_makereport(__multicall__, item, call):
if not evalxfail:
return
if call.excinfo and call.excinfo.errisinstance(py.test.xfail.Exception):
rep = __multicall__.execute()
rep.keywords['xfail'] = "reason: " + call.excinfo.value.msg
rep.skipped = True
rep.failed = False
return rep
if not item.config.getvalue("runxfail"):
rep = __multicall__.execute()
rep.keywords['xfail'] = "reason: " + call.excinfo.value.msg
rep.skipped = True
rep.failed = False
return rep
if call.when == "setup":
rep = __multicall__.execute()
if rep.skipped and evalxfail.istrue():

View File

@ -216,6 +216,11 @@ class TestXFail:
result.stdout.fnmatch_lines([
"*XFAIL*test_this*reason:*hello*",
])
result = testdir.runpytest(p, "--runxfail")
result.stdout.fnmatch_lines([
"*def test_this():*",
"*py.test.xfail*",
])
def test_xfail_imperative_in_setup_function(self, testdir):
p = testdir.makepyfile("""
@ -234,6 +239,11 @@ class TestXFail:
result.stdout.fnmatch_lines([
"*XFAIL*test_this*reason:*hello*",
])
result = testdir.runpytest(p, "--runxfail")
result.stdout.fnmatch_lines([
"*def setup_function(function):*",
"*py.test.xfail*",
])