debugger

lsst.utils.tests.debugger(*exceptions)

Enter the debugger when there’s an uncaught exception.

To use, just slap a @debugger() on your function.

You may provide specific exception classes to catch as arguments to the decorator function, e.g., @debugger(RuntimeError, NotImplementedError). This defaults to just AssertionError, for use on unittest.TestCase methods.

Code provided by “Rosh Oxymoron” on StackOverflow: http://stackoverflow.com/questions/4398967/python-unit-testing-automatically-running-the-debugger-when-a-test-fails

Parameters:
*exceptionsException

Specific exception classes to catch. Default is to catch AssertionError.

Notes

Consider using pytest --pdb instead of this decorator.