diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -24,6 +24,7 @@ -- dump the traceback and exit if a test takes more than TIMEOUT seconds (default: 30 minutes); disable the timeout if TIMEOUT is zero +-a/--attach -- wait for user input to allow a debugger to be attached Verbosity @@ -268,13 +269,13 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:a', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', - 'start=', 'nowindows', 'header', 'testdir=', 'timeout=']) + 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'attach']) except getopt.error as msg: usage(msg) @@ -410,6 +411,8 @@ testdir = os.path.join(support.SAVEDCWD, a) elif o == '--timeout': timeout = float(a) + elif o in ('-a', '--attach'): + input("Attach a debugger. Press any key to continue...") else: print(("No handler for option {}. Please report this as a bug " "at http://bugs.python.org.").format(o), file=sys.stderr)