2
This plugin provides --pdb and --pdb-failures options that cause the
3
test runner to drop into pdb if it encounters an error or failure,
9
from nose.plugins.base import Plugin
13
Provides --pdb and --pdb-failures options that cause the test runner to
14
drop into pdb if it encounters an error or failure, respectively.
16
enabled_for_errors = False
17
enabled_for_failures = False
18
score = 5 # run last, among builtins
20
def options(self, parser, env=os.environ):
22
"--pdb", action="store_true", dest="debugErrors",
23
default=env.get('NOSE_PDB', False),
24
help="Drop into debugger on errors")
26
"--pdb-failures", action="store_true",
28
default=env.get('NOSE_PDB_FAILURES', False),
29
help="Drop into debugger on failures")
31
def configure(self, options, conf):
33
self.enabled = options.debugErrors or options.debugFailures
34
self.enabled_for_errors = options.debugErrors
35
self.enabled_for_failures = options.debugFailures
37
def addError(self, test, err):
38
if not self.enabled_for_errors:
42
def addFailure(self, test, err):
43
if not self.enabled_for_failures:
51
sys.stdout = sys.__stdout__