diff --git a/py/_plugin/pytest_skipping.py b/py/_plugin/pytest_skipping.py index 915238f94..c7de83924 100644 --- a/py/_plugin/pytest_skipping.py +++ b/py/_plugin/pytest_skipping.py @@ -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(): diff --git a/testing/plugin/test_pytest_skipping.py b/testing/plugin/test_pytest_skipping.py index 2058a5fb0..e2923cedb 100644 --- a/testing/plugin/test_pytest_skipping.py +++ b/testing/plugin/test_pytest_skipping.py @@ -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*", + ])