From 225341cf2ca4733a739ec7ba2fe63cb834e0bb34 Mon Sep 17 00:00:00 2001 From: Raphael Pierzina Date: Sat, 13 Aug 2016 00:00:51 +0100 Subject: [PATCH] Set wasxfail only for xpass w/o strict and else set longrepr --- _pytest/skipping.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_pytest/skipping.py b/_pytest/skipping.py index bd27870d6..651aa1a19 100644 --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -251,11 +251,13 @@ def pytest_runtest_makereport(item, call): elif call.when == "call": strict_default = item.config.getini('xfail_strict') is_strict_xfail = evalxfail.get('strict', strict_default) + explanation = evalxfail.getexplanation() if is_strict_xfail: rep.outcome = "failed" + rep.longrepr = "[XPASS(strict)] {0}".format(explanation) else: rep.outcome = "passed" - rep.wasxfail = evalxfail.getexplanation() + rep.wasxfail = explanation elif evalskip is not None and rep.skipped and type(rep.longrepr) is tuple: # skipped by mark.skipif; change the location of the failure # to point to the item definition, otherwise it will display