-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using ipdb with --pdbcls and tab completion #4008
Comments
def Debugger():
import ipdb
return ipdb isn't a class and so when pytest tries to inherit from it it splodes. Have you considered trying pytest-ipdb (marked as deprecated) or pdb++? |
I got slightly further with: class IPDB(object):
def __new__(*a):
import ipdb
return ipdb
|
That's interesting! I'll take another stab |
@jenn-clarke93 and I found this worked with the most recent version: class Debugger(object):
quitting = None
def set_trace(self, frame):
import ipdb
return ipdb.set_trace(frame)
def reset(self, *args, **kwargs):
from ipdb.__main__ import _init_pdb
pdb_obj = _init_pdb()
pdb_obj.botframe = None # not sure. exception otherwise at quit
return pdb_obj.reset(*args, **kwargs)
def interaction(self, *args, **kwargs):
from ipdb.__main__ import _init_pdb
pdb_obj = _init_pdb()
pdb_obj.botframe = None # not sure. exception otherwise at quit
return pdb_obj.interaction(*args, **kwargs) |
might be worth packaging that up to a |
True, I might reach out to the owner of the repo to see if I can take over the existing one. |
I created https://github.com/JBKahn/pytest-ipdb-cls based on a fork and gutting all the things. I want to see if I can think of a good way to add a test for this. Then I can release it. |
FWIW: Closing this issue for now. |
This appears to be broken in |
I reverted to the snippet I posted above |
@conanfanli @JBKahn |
In my pytest config, I have:
This works fine in version
in my test, I should get tab completion. |
btw: |
Some findings:
diff --git i/src/_pytest/debugging.py w/src/_pytest/debugging.py
index 3bfd5465f..e4df74e4b 100644
--- i/src/_pytest/debugging.py
+++ w/src/_pytest/debugging.py
@@ -21,6 +21,7 @@ def _validate_usepdb_cls(value):
raise argparse.ArgumentTypeError(
"{!r} is not in the format 'modname:classname'".format(value)
)
+ _import_pdbcls(modname, classname)
return (modname, classname) Re-opening, but will not investigate further myself - I recommend using pdbpp instead.. ;) |
I think |
Closing this a duplicate of #2064, which has more information. |
Hi!
I'm trying to get ipdb and the
--pdbcls
to work together perfectly. I was wondering if anyone else has been able to do it. I currently have two solutions for two different use cases.If I set it using
--pdbcls=IPython.core.debugger:Pdb
then I can usepytest --pdb
to get into a shell on exceptions or when I usepytest.set_trace()
but neither of them support tab completion and everything ipdb supports.If I create my own class:
and use that as my
pdbcls
then I can usepytest.set_trace()
with tab completion and all that nice stuff but when I use--pdb
I get an exception like this:Here are the pytest packages I'm currently using:
and python version
3.6.5
The text was updated successfully, but these errors were encountered: