unittest: handle outcomes.Exit
This is required for pytest to stop when using "quit" in pdb, and should get honored/handled in general.
This commit is contained in:
@@ -6,6 +6,7 @@ import _pytest._code
|
||||
import pytest
|
||||
from _pytest.compat import getimfunc
|
||||
from _pytest.config import hookimpl
|
||||
from _pytest.outcomes import exit
|
||||
from _pytest.outcomes import fail
|
||||
from _pytest.outcomes import skip
|
||||
from _pytest.outcomes import xfail
|
||||
@@ -153,6 +154,11 @@ class TestCaseFunction(Function):
|
||||
self.__dict__.setdefault("_excinfo", []).append(excinfo)
|
||||
|
||||
def addError(self, testcase, rawexcinfo):
|
||||
try:
|
||||
if isinstance(rawexcinfo[1], exit.Exception):
|
||||
exit(rawexcinfo[1].msg)
|
||||
except TypeError:
|
||||
pass
|
||||
self._addexcinfo(rawexcinfo)
|
||||
|
||||
def addFailure(self, testcase, rawexcinfo):
|
||||
|
||||
Reference in New Issue
Block a user