MCPcopy Index your code
hub / github.com/python/cpython / _create_parser

Function _create_parser

Lib/test/libregrtest/cmdline.py:221–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219
220
221def _create_parser():
222 # Set prog to prevent the uninformative "__main__.py" from displaying in
223 # error messages when using "python -m test ...".
224 parser = _ArgParser(prog='regrtest.py',
225 usage=USAGE,
226 description=DESCRIPTION,
227 epilog=EPILOG,
228 add_help=False,
229 formatter_class=argparse.RawDescriptionHelpFormatter)
230 parser.set_defaults(match_tests=[])
231
232 # Arguments with this clause added to its help are described further in
233 # the epilog's "Additional option details" section.
234 more_details = ' See the section at bottom for more details.'
235
236 group = parser.add_argument_group('General options')
237 # We add help explicitly to control what argument group it renders under.
238 group.add_argument('-h', '--help', action='help',
239 help='show this help message and exit')
240 group.add_argument('--fast-ci', action='store_true',
241 help='Fast Continuous Integration (CI) mode used by '
242 'GitHub Actions')
243 group.add_argument('--slow-ci', action='store_true',
244 help='Slow Continuous Integration (CI) mode used by '
245 'buildbot workers')
246 group.add_argument('--timeout', metavar='TIMEOUT',
247 help='dump the traceback and exit if a test takes '
248 'more than TIMEOUT seconds; disabled if TIMEOUT '
249 'is negative or equals to zero')
250 group.add_argument('--wait', action='store_true',
251 help='wait for user input, e.g., allow a debugger '
252 'to be attached')
253 group.add_argument('-S', '--start', metavar='START',
254 help='resume an interrupted run at the following test.' +
255 more_details)
256 group.add_argument('-p', '--python', metavar='PYTHON',
257 help='Command to run Python test subprocesses with.')
258 group.add_argument('--randseed', metavar='SEED',
259 dest='random_seed', type=int,
260 help='pass a global random seed')
261
262 group = parser.add_argument_group('Verbosity')
263 group.add_argument('-v', '--verbose', action='count',
264 help='run tests in verbose mode with output to stdout')
265 group.add_argument('-w', '--rerun', action='store_true',
266 help='re-run failed tests in verbose mode')
267 group.add_argument('--verbose2', action='store_true', dest='rerun',
268 help='deprecated alias to --rerun')
269 group.add_argument('-W', '--verbose3', action='store_true',
270 help='display test output on failure')
271 group.add_argument('-q', '--quiet', action='store_true',
272 help='no output unless one or more tests fail')
273 group.add_argument('-o', '--slowest', action='store_true', dest='print_slow',
274 help='print the slowest 10 tests')
275 group.add_argument('--header', action='store_true',
276 help='print header with interpreter info')
277
278 group = parser.add_argument_group('Selecting tests')

Callers 1

_parse_argsFunction · 0.70

Calls 4

_ArgParserClass · 0.85
set_defaultsMethod · 0.45
add_argument_groupMethod · 0.45
add_argumentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…