MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / debug_script

Function debug_script

tools/python-3.11.9-amd64/Lib/doctest.py:2657–2675  ·  view source on GitHub ↗

Debug a test script. `src` is the script, as a string.

(src, pm=False, globs=None)

Source from the content-addressed store, hash-verified

2655 debug_script(testsrc, pm, globs)
2656
2657def 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
2677def debug(module, name, pm=False):
2678 """Debug a single doctest docstring.

Callers 2

debug_srcFunction · 0.85
debugFunction · 0.85

Calls 5

resetMethod · 0.95
interactionMethod · 0.95
printFunction · 0.50
copyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected