Set wasxfail only for xpass w/o strict and else set longrepr

This commit is contained in:
Raphael Pierzina 2016-08-13 00:00:51 +01:00
parent 14a4dd0697
commit 225341cf2c
1 changed files with 3 additions and 1 deletions

View File

@ -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