Closed MrMino closed 4 years ago
but since chances of having this feature implemented any time soon by python core devs is probably close to nil, here goes:
Scratch that. https://docs.python.org/3/library/pdb.html:
New in version 3.7: pdb.py now accepts a -m option that execute modules similar to the way python3 -m does. As with a script, the debugger will pause execution just before the first line of the module.
I think I might be able to PR this.
Hey, @gotcha, pretty please :)? I know you're probably seriously busy, and your todo-list is as long as your arm and a leg - understandable. This is a simple, 20 line merge request which was done by analogy to what's already implemented in pdb - nothing fancy there, and it adds a really cool feature. I'd love to use it on machines at work where we install ipdb automatically, without having to resort to patching it up every time.
This has been released in v0.13.4, see linked PR.
I don't know whether this request should be pointed at pdb rather than ipdb, ~but since chances of having this feature implemented any time soon by python core devs is probably close to nil,~ here goes:
Taken from
man python
:This can be used to run unittests:
Sometimes when tests fail, in order to run a post mortem on them, I have to manually find the failing testcase, add
import ipdb; ipdb.set_trace()
to it, rerun the thing, c, Enter... only to find out that I added theset_trace()
in the wrong line.I'd like to kindly request that the
-m
be added to ipdb with the same semantics as the interpreter option.This will make it very simple to debug testcases:
c, Enter Traceback... ddddd... until the bottom frame profit