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

Notes

Consider using pytest --pdb instead of this decorator.