diff options
author | Daniel Hahler <git@thequod.de> | 2019-07-19 02:54:54 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-07-19 02:57:25 +0200 |
commit | 63d517645ce0ceb36ab36a778d4f33c93a2c77a8 (patch) | |
tree | 70e1c857c1757eb690943fba2e467b4156e8d995 /src/_pytest/doctest.py | |
parent | faf222f8fb0d41c81a3e4d5bbc3dd465e02c2b40 (diff) | |
download | pytest-63d517645ce0ceb36ab36a778d4f33c93a2c77a8.tar.gz |
doctest: handle BdbQuit
Map `BdbQuit` exception to `outcomes.Exit`.
This is necessary since we are not wrapping `pdb.set_trace` there, and
therefore our `do_quit` is not called.
Diffstat (limited to 'src/_pytest/doctest.py')
-rw-r--r-- | src/_pytest/doctest.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index cf886f906..1bd2642ae 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -1,4 +1,5 @@ """ discover and run doctests in modules and test files.""" +import bdb import inspect import platform import sys @@ -7,6 +8,7 @@ import warnings from contextlib import contextmanager import pytest +from _pytest import outcomes from _pytest._code.code import ExceptionInfo from _pytest._code.code import ReprFileLocation from _pytest._code.code import TerminalRepr @@ -155,6 +157,8 @@ def _init_runner_class(): def report_unexpected_exception(self, out, test, example, exc_info): if isinstance(exc_info[1], Skipped): raise exc_info[1] + if isinstance(exc_info[1], bdb.BdbQuit): + outcomes.exit("Quitting debugger") failure = doctest.UnexpectedException(test, example, exc_info) if self.continue_on_failure: out.append(failure) |