Show More
@@ -451,7 +451,13 b' class ExecutionMagics(Magics):' | |||||
451 |
|
451 | |||
452 | if not (args.breakpoint or args.statement or cell): |
|
452 | if not (args.breakpoint or args.statement or cell): | |
453 | self._debug_post_mortem() |
|
453 | self._debug_post_mortem() | |
|
454 | elif not (args.breakpoint or cell): | |||
|
455 | # If there is no breakpoints, the line is just code to execute | |||
|
456 | self._debug_exec(line, None) | |||
454 | else: |
|
457 | else: | |
|
458 | # Here we try to reconstruct the code from the output of | |||
|
459 | # parse_argstring. This might not work if the code has spaces | |||
|
460 | # For example this fails for `print("a b")` | |||
455 | code = "\n".join(args.statement) |
|
461 | code = "\n".join(args.statement) | |
456 | if cell: |
|
462 | if cell: | |
457 | code += "\n" + cell |
|
463 | code += "\n" + cell |
@@ -32,6 +32,7 b' from IPython.utils.io import capture_output' | |||||
32 | from IPython.utils.tempdir import (TemporaryDirectory, |
|
32 | from IPython.utils.tempdir import (TemporaryDirectory, | |
33 | TemporaryWorkingDirectory) |
|
33 | TemporaryWorkingDirectory) | |
34 | from IPython.utils.process import find_cmd |
|
34 | from IPython.utils.process import find_cmd | |
|
35 | from .test_debugger import PdbTestInput | |||
35 |
|
36 | |||
36 |
|
37 | |||
37 | @magic.magics_class |
|
38 | @magic.magics_class | |
@@ -599,6 +600,18 b' def doctest_precision():' | |||||
599 | Out[5]: '3.141593e+00' |
|
600 | Out[5]: '3.141593e+00' | |
600 | """ |
|
601 | """ | |
601 |
|
602 | |||
|
603 | def test_debug_magic(): | |||
|
604 | """Test debugging a small code with %debug | |||
|
605 | ||||
|
606 | In [1]: with PdbTestInput(['c']): | |||
|
607 | ...: %debug print("a b") #doctest: +ELLIPSIS | |||
|
608 | ...: | |||
|
609 | ... | |||
|
610 | ipdb> c | |||
|
611 | a b | |||
|
612 | In [2]: | |||
|
613 | """ | |||
|
614 | ||||
602 | def test_psearch(): |
|
615 | def test_psearch(): | |
603 | with tt.AssertPrints("dict.fromkeys"): |
|
616 | with tt.AssertPrints("dict.fromkeys"): | |
604 | _ip.run_cell("dict.fr*?") |
|
617 | _ip.run_cell("dict.fr*?") |
General Comments 0
You need to be logged in to leave comments.
Login now