This is a bit of a newbie question about basic python workflow. I have a library of python files, and a collection of associated unit tests. One of the tests is failing and I'd like to inject pdb at the spot of the failure.
My workflow uses elpy and emacs, which I otherwise quite like and would prefer to stick with. I load the test file in emacs, start a python shell, and then run the test code in the python shell. Something throws an exception, which causes the test to fail. The python process ends and prints a stack trace.
If the process were still alive I'd call pdb.pm()
to start the debugger at the source of the error so that I could investigate the stack interactively, and that is what I'm trying to achieve. The basic structure of the unit test file is
import unittest
import other_stuff
class MyTest(unittest.TestCase):
def test_other_stuff(self):
self.assertTrue(other_stuff.function_call() == expected_result)
def test_other_other_stuff(self):
pass # you get the idea
if __name__ == "__main__":
unittest.main(verbosity=2)