4 ms·
You can also add breakpoints which automatically occurs when exceptions are raised. Which is similar to the breakloop functionality mentioned in the article.
by joshlk 6y ago
You can also add breakpoints which automatically occurs when exceptions are raised. Which is similar to the breakloop functionality mentioned in the article.
- djm_ 6y agoYes, running pytest with the --pdb flag will drop you into the debugger on an unhandled exception which gets a comparable workflow but it's not quite the same as, a) writing tests to file first is not repl-driven development, and b) you generally have to think about doing it first. In an ideal repl-driven world you could write the test in the repl entirely and commit it to disk once you're ready.
- anentropic 6y agoI find ipython + ipdb super useful in this regard But AFAIK neither provide the feature described in the article where you can continue running after an unhandled exception.
- jmuhlich 6y agoTrue, but running the %debug magic command in IPython immediately after an unhandled exception drops you into the debugger at the point of the raised exception, complete with the full interpreter state including the stack. It doesn’t permit edit-and-continue but you can still evaluate expressions (including calling any function) to explore what went wrong without having to recreate the situation inside an explicit pdb session.