@@ -52,6 +52,16 @@ def reset(self):
5252 def interaction (self , * args ):
5353 called .append ("interaction" )
5454
55+ # Methods which we copy the docstring over.
56+ def do_debug (self , * args ):
57+ pass
58+
59+ def do_continue (self , * args ):
60+ pass
61+
62+ def do_quit (self , * args ):
63+ pass
64+
5565 _pytest ._CustomPdb = _CustomPdb # type: ignore
5666 return called
5767
@@ -75,6 +85,16 @@ def set_trace(self, frame):
7585 print ("**CustomDebugger**" )
7686 called .append ("set_trace" )
7787
88+ # Methods which we copy the docstring over.
89+ def do_debug (self , * args ):
90+ pass
91+
92+ def do_continue (self , * args ):
93+ pass
94+
95+ def do_quit (self , * args ):
96+ pass
97+
7898 _pytest ._CustomDebugger = _CustomDebugger # type: ignore
7999 yield called
80100 del _pytest ._CustomDebugger # type: ignore
@@ -965,6 +985,34 @@ def test_1():
965985 child .sendeof ()
966986 self .flush (child )
967987
988+ def test_pdb_wrapped_commands_docstrings (self , pytester : Pytester ) -> None :
989+ p1 = pytester .makepyfile (
990+ """
991+ def test_1():
992+ assert False
993+ """
994+ )
995+
996+ child = pytester .spawn_pytest (f"--pdb { p1 } " )
997+ child .expect ("Pdb" )
998+
999+ # Verify no undocumented commands
1000+ child .sendline ("help" )
1001+ child .expect ("Documented commands" )
1002+ assert "Undocumented commands" not in child .before .decode ()
1003+
1004+ child .sendline ("help continue" )
1005+ child .expect ("Continue execution" )
1006+ child .expect ("Pdb" )
1007+
1008+ child .sendline ("help debug" )
1009+ child .expect ("Enter a recursive debugger" )
1010+ child .expect ("Pdb" )
1011+
1012+ child .sendline ("c" )
1013+ child .sendeof ()
1014+ self .flush (child )
1015+
9681016
9691017class TestDebuggingBreakpoints :
9701018 @pytest .mark .parametrize ("arg" , ["--pdb" , "" ])
@@ -1288,6 +1336,16 @@ def set_trace(self, *args):
12881336
12891337 def runcall(self, *args, **kwds):
12901338 print("runcall_called", args, kwds)
1339+
1340+ # Methods which we copy the docstring over.
1341+ def do_debug(self, *args):
1342+ pass
1343+
1344+ def do_continue(self, *args):
1345+ pass
1346+
1347+ def do_quit(self, *args):
1348+ pass
12911349 """ ,
12921350 )
12931351 result = pytester .runpytest (
@@ -1354,6 +1412,16 @@ def __init__(self, *args, **kwargs):
13541412
13551413 def set_trace(self, *args):
13561414 print("set_trace_called", args)
1415+
1416+ # Methods which we copy the docstring over.
1417+ def do_debug(self, *args):
1418+ pass
1419+
1420+ def do_continue(self, *args):
1421+ pass
1422+
1423+ def do_quit(self, *args):
1424+ pass
13571425 """ ,
13581426 )
13591427 result = pytester .runpytest (str (p1 ), "--pdbcls=mypdb:MyPdb" , syspathinsert = True )
0 commit comments