when --runxfail is supplied also show tracebacks when running a test that
calls py.test.xfail --HG-- branch : trunk
This commit is contained in:
parent
29a5b7452e
commit
fa074da5a9
|
@ -218,11 +218,12 @@ def pytest_runtest_makereport(__multicall__, item, call):
|
||||||
if not evalxfail:
|
if not evalxfail:
|
||||||
return
|
return
|
||||||
if call.excinfo and call.excinfo.errisinstance(py.test.xfail.Exception):
|
if call.excinfo and call.excinfo.errisinstance(py.test.xfail.Exception):
|
||||||
rep = __multicall__.execute()
|
if not item.config.getvalue("runxfail"):
|
||||||
rep.keywords['xfail'] = "reason: " + call.excinfo.value.msg
|
rep = __multicall__.execute()
|
||||||
rep.skipped = True
|
rep.keywords['xfail'] = "reason: " + call.excinfo.value.msg
|
||||||
rep.failed = False
|
rep.skipped = True
|
||||||
return rep
|
rep.failed = False
|
||||||
|
return rep
|
||||||
if call.when == "setup":
|
if call.when == "setup":
|
||||||
rep = __multicall__.execute()
|
rep = __multicall__.execute()
|
||||||
if rep.skipped and evalxfail.istrue():
|
if rep.skipped and evalxfail.istrue():
|
||||||
|
|
|
@ -216,6 +216,11 @@ class TestXFail:
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"*XFAIL*test_this*reason:*hello*",
|
"*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):
|
def test_xfail_imperative_in_setup_function(self, testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
|
@ -234,6 +239,11 @@ class TestXFail:
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"*XFAIL*test_this*reason:*hello*",
|
"*XFAIL*test_this*reason:*hello*",
|
||||||
])
|
])
|
||||||
|
result = testdir.runpytest(p, "--runxfail")
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*def setup_function(function):*",
|
||||||
|
"*py.test.xfail*",
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue