本文整理汇总了Python中test.regrtest._parse_args函数的典型用法代码示例。如果您正苦于以下问题:Python _parse_args函数的具体用法?Python _parse_args怎么用?Python _parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_parse_args函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_help
def test_help(self):
for opt in '-h', '--help':
with self.subTest(opt=opt):
with support.captured_stdout() as out, \
self.assertRaises(SystemExit):
regrtest._parse_args([opt])
self.assertIn('Run Python regression tests.', out.getvalue())
示例2: test_failfast
def test_failfast(self):
for opt in '-G', '--failfast':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, '-v'])
self.assertTrue(ns.failfast)
ns = regrtest._parse_args([opt, '-W'])
self.assertTrue(ns.failfast)
self.checkError([opt], '-G/--failfast needs either -v or -W')
示例3: test_verbose
def test_verbose(self):
ns = regrtest._parse_args(['-v'])
self.assertEqual(ns.verbose, 1)
ns = regrtest._parse_args(['-vvv'])
self.assertEqual(ns.verbose, 3)
ns = regrtest._parse_args(['--verbose'])
self.assertEqual(ns.verbose, 1)
ns = regrtest._parse_args(['--verbose'] * 3)
self.assertEqual(ns.verbose, 3)
ns = regrtest._parse_args([])
self.assertEqual(ns.verbose, 0)
示例4: test_use
def test_use(self):
for opt in '-u', '--use':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, 'gui,network'])
self.assertEqual(ns.use_resources, ['gui', 'network'])
ns = regrtest._parse_args([opt, 'gui,none,network'])
self.assertEqual(ns.use_resources, ['network'])
expected = list(regrtest.RESOURCE_NAMES)
expected.remove('gui')
ns = regrtest._parse_args([opt, 'all,-gui'])
self.assertEqual(ns.use_resources, expected)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid resource')
示例5: test_threshold
def test_threshold(self):
for opt in '-t', '--threshold':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, '1000'])
self.assertEqual(ns.threshold, 1000)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid int value')
示例6: test_huntrleaks
def test_huntrleaks(self):
for opt in '-R', '--huntrleaks':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, ':'])
self.assertEqual(ns.huntrleaks, (5, 4, 'reflog.txt'))
ns = regrtest._parse_args([opt, '6:'])
self.assertEqual(ns.huntrleaks, (6, 4, 'reflog.txt'))
ns = regrtest._parse_args([opt, ':3'])
self.assertEqual(ns.huntrleaks, (5, 3, 'reflog.txt'))
ns = regrtest._parse_args([opt, '6:3:leaks.log'])
self.assertEqual(ns.huntrleaks, (6, 3, 'leaks.log'))
self.checkError([opt], 'expected one argument')
self.checkError([opt, '6'],
'needs 2 or 3 colon-separated arguments')
self.checkError([opt, 'foo:'], 'invalid huntrleaks value')
self.checkError([opt, '6:foo'], 'invalid huntrleaks value')
示例7: test_fromfile
def test_fromfile(self):
for opt in '-f', '--fromfile':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.fromfile, 'foo')
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo', '-s'], "don't go together")
示例8: test_coverdir
def test_coverdir(self):
for opt in '-D', '--coverdir':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.coverdir,
os.path.join(support.SAVEDCWD, 'foo'))
self.checkError([opt], 'expected one argument')
示例9: test_multiprocess
def test_multiprocess(self):
for opt in '-j', '--multiprocess':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, '2'])
self.assertEqual(ns.use_mp, 2)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid int value')
self.checkError([opt, '2', '-T'], "don't go together")
self.checkError([opt, '2', '-l'], "don't go together")
self.checkError([opt, '2', '-M', '4G'], "don't go together")
示例10: test_start
def test_start(self):
for opt in '-S', '--start':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.start, 'foo')
self.checkError([opt], 'expected one argument')
示例11: test_forever
def test_forever(self):
for opt in '-F', '--forever':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
self.assertTrue(ns.forever)
示例12: test_wait
def test_wait(self):
ns = regrtest._parse_args(['--wait'])
self.assertTrue(ns.wait)
示例13: test_slaveargs
def test_slaveargs(self):
ns = regrtest._parse_args(['--slaveargs', '[[], {}]'])
self.assertEqual(ns.slaveargs, '[[], {}]')
self.checkError(['--slaveargs'], 'expected one argument')
示例14: test_arg_option_arg
def test_arg_option_arg(self):
ns = regrtest._parse_args(['test_unaryop', '-v', 'test_binop'])
self.assertEqual(ns.verbose, 1)
self.assertEqual(ns.args, ['test_unaryop', 'test_binop'])
示例15: test_timeout
def test_timeout(self):
ns = regrtest._parse_args(['--timeout', '4.2'])
self.assertEqual(ns.timeout, 4.2)
self.checkError(['--timeout'], 'expected one argument')
self.checkError(['--timeout', 'foo'], 'invalid float value')