Drop Into An Interactive Session To Examine A Failed Unit Test
I'd like to be able to enter an interactive session, preferably with IPython, if a unit test fails. Is there an easy way to do this? edit: by 'interactive session' I mean a full P
Solution 1:
In IPython, use %pdb before running the test
In [9]: %pdb
Automatic pdb calling has been turned ON
Solution 2:
Nosetests runner provides --pdb
option that will put you into the debugger session on errors or failures.
Solution 3:
Are you really sure you want to do this? Your unit tests should do one thing, should be well-named, and should clearly print what failed. If you do all of that, the failure message will pinpoint what went wrong; no need to go look at it interactively. In fact, one of the big advantages of TDD is that it helps you avoid having to go into the debugger at all to diagnose problems.
Post a Comment for "Drop Into An Interactive Session To Examine A Failed Unit Test"