@@ -230,7 +230,8 @@ def pytest_runtest_makereport(item, call):
230
230
if hasattr (item , '_unexpectedsuccess' ) and rep .when == "call" :
231
231
# we need to translate into how pytest encodes xpass
232
232
rep .wasxfail = "reason: " + repr (item ._unexpectedsuccess )
233
- rep .outcome = "failed"
233
+ # TODO: Do we need to check for strict xfail here as well?
234
+ rep .outcome = "passed"
234
235
elif item .config .option .runxfail :
235
236
pass # don't interefere
236
237
elif call .excinfo and call .excinfo .errisinstance (pytest .xfail .Exception ):
@@ -245,7 +246,12 @@ def pytest_runtest_makereport(item, call):
245
246
rep .outcome = "skipped"
246
247
rep .wasxfail = evalxfail .getexplanation ()
247
248
elif call .when == "call" :
248
- rep .outcome = "failed" # xpass outcome
249
+ strict_default = item .config .getini ('xfail_strict' )
250
+ is_strict_xfail = evalxfail .get ('strict' , strict_default )
251
+ if is_strict_xfail :
252
+ rep .outcome = "failed"
253
+ else :
254
+ rep .outcome = "passed"
249
255
rep .wasxfail = evalxfail .getexplanation ()
250
256
elif evalskip is not None and rep .skipped and type (rep .longrepr ) is tuple :
251
257
# skipped by mark.skipif; change the location of the failure
@@ -260,7 +266,7 @@ def pytest_report_teststatus(report):
260
266
if hasattr (report , "wasxfail" ):
261
267
if report .skipped :
262
268
return "xfailed" , "x" , "xfail"
263
- elif report .failed :
269
+ elif report .passed :
264
270
return "xpassed" , "X" , ("XPASS" , {'yellow' : True })
265
271
266
272
# called by the terminalreporter instance/plugin
0 commit comments