Debug a test script. `src` is the script, as a string.
(src, pm=False, globs=None)
| 2655 | debug_script(testsrc, pm, globs) |
| 2656 | |
| 2657 | def debug_script(src, pm=False, globs=None): |
| 2658 | "Debug a test script. `src` is the script, as a string." |
| 2659 | import pdb |
| 2660 | |
| 2661 | if globs: |
| 2662 | globs = globs.copy() |
| 2663 | else: |
| 2664 | globs = {} |
| 2665 | |
| 2666 | if pm: |
| 2667 | try: |
| 2668 | exec(src, globs, globs) |
| 2669 | except: |
| 2670 | print(sys.exc_info()[1]) |
| 2671 | p = pdb.Pdb(nosigint=True) |
| 2672 | p.reset() |
| 2673 | p.interaction(None, sys.exc_info()[2]) |
| 2674 | else: |
| 2675 | pdb.Pdb(nosigint=True).run("exec(%r)" % src, globs, globs) |
| 2676 | |
| 2677 | def debug(module, name, pm=False): |
| 2678 | """Debug a single doctest docstring. |