Skip to content

Commit 225341c

Browse files
committed
Set wasxfail only for xpass w/o strict and else set longrepr
1 parent 14a4dd0 commit 225341c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

_pytest/skipping.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ def pytest_runtest_makereport(item, call):
251251
elif call.when == "call":
252252
strict_default = item.config.getini('xfail_strict')
253253
is_strict_xfail = evalxfail.get('strict', strict_default)
254+
explanation = evalxfail.getexplanation()
254255
if is_strict_xfail:
255256
rep.outcome = "failed"
257+
rep.longrepr = "[XPASS(strict)] {0}".format(explanation)
256258
else:
257259
rep.outcome = "passed"
258-
rep.wasxfail = evalxfail.getexplanation()
260+
rep.wasxfail = explanation
259261
elif evalskip is not None and rep.skipped and type(rep.longrepr) is tuple:
260262
# skipped by mark.skipif; change the location of the failure
261263
# to point to the item definition, otherwise it will display

0 commit comments

Comments
 (0)