File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -228,10 +228,13 @@ def pytest_runtest_makereport(item, call):
228
228
evalskip = getattr (item , '_evalskip' , None )
229
229
# unitttest special case, see setting of _unexpectedsuccess
230
230
if hasattr (item , '_unexpectedsuccess' ) and rep .when == "call" :
231
- # we need to translate into how pytest encodes xpass
232
- rep .wasxfail = "reason: " + repr (item ._unexpectedsuccess )
233
- # TODO: Do we need to check for strict xfail here as well?
234
- rep .outcome = "passed"
231
+ # unittest treats an 'unexpected successes' as a failure
232
+ # which means pytest needs to handle it like a 'xfail(strict=True)'
233
+ rep .outcome = "failed"
234
+ if item ._unexpectedsuccess :
235
+ rep .longrepr = "Unexpected success: {0}" .format (item ._unexpectedsuccess )
236
+ else :
237
+ rep .longrepr = "Unexpected success"
235
238
elif item .config .option .runxfail :
236
239
pass # don't interefere
237
240
elif call .excinfo and call .excinfo .errisinstance (pytest .xfail .Exception ):
You can’t perform that action at this time.
0 commit comments