Check if returncode is not None before assigning test return code

This commit is contained in:
Jose Carlos Menezes 2018-10-14 18:43:48 -03:00
parent d32f2c5c14
commit 76fb9970c8
1 changed files with 2 additions and 1 deletions

View File

@ -188,7 +188,8 @@ def wrap_session(config, doit):
exitstatus = EXIT_INTERRUPTED
if initstate <= 2 and isinstance(excinfo.value, exit.Exception):
sys.stderr.write("{}: {}\n".format(excinfo.typename, excinfo.value.msg))
exitstatus = excinfo.value.returncode
if excinfo.value.returncode is not None:
exitstatus = excinfo.value.returncode
config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
session.exitstatus = exitstatus
except: # noqa