Improve quitting from pdb
Regarding tests: it merges ``test_pdb_interaction``, ``test_pdb_print_captured_stdout``, and ``test_pdb_print_captured_stderr`` into ``test_pdb_print_captured_stdout_and_stderr`` (clarity and performance, especially since pexpect tests are slow).
This commit is contained in:
@@ -118,6 +118,10 @@ class pytestPDB(object):
|
||||
|
||||
do_c = do_cont = do_continue
|
||||
|
||||
def set_quit(self):
|
||||
super(_PdbWrapper, self).set_quit()
|
||||
outcomes.exit("Quitting debugger")
|
||||
|
||||
def setup(self, f, tb):
|
||||
"""Suspend on setup().
|
||||
|
||||
@@ -210,8 +214,7 @@ def _enter_pdb(node, excinfo, rep):
|
||||
tw.sep(">", "entering PDB")
|
||||
tb = _postmortem_traceback(excinfo)
|
||||
rep._pdbshown = True
|
||||
if post_mortem(tb):
|
||||
outcomes.exit("Quitting debugger")
|
||||
post_mortem(tb)
|
||||
return rep
|
||||
|
||||
|
||||
@@ -242,4 +245,5 @@ def post_mortem(t):
|
||||
p = Pdb()
|
||||
p.reset()
|
||||
p.interaction(None, t)
|
||||
return p.quitting
|
||||
if p.quitting:
|
||||
outcomes.exit("Quitting debugger")
|
||||
|
||||
@@ -49,13 +49,13 @@ class Failed(OutcomeException):
|
||||
__module__ = "builtins"
|
||||
|
||||
|
||||
class Exit(SystemExit):
|
||||
class Exit(Exception):
|
||||
""" raised for immediate program exits (no tracebacks/summaries)"""
|
||||
|
||||
def __init__(self, msg="unknown reason", returncode=None):
|
||||
self.msg = msg
|
||||
self.returncode = returncode
|
||||
SystemExit.__init__(self, msg)
|
||||
super(Exit, self).__init__(msg)
|
||||
|
||||
|
||||
# exposed helper methods
|
||||
@@ -63,7 +63,7 @@ class Exit(SystemExit):
|
||||
|
||||
def exit(msg, returncode=None):
|
||||
"""
|
||||
Exit testing process as if SystemExit was triggered.
|
||||
Exit testing process.
|
||||
|
||||
:param str msg: message to display upon exit.
|
||||
:param int returncode: return code to be used when exiting pytest.
|
||||
|
||||
Reference in New Issue
Block a user