本文整理汇总了Python中test.regrtest._parse_args函数的典型用法代码示例。如果您正苦于以下问题:Python _parse_args函数的具体用法?Python _parse_args怎么用?Python _parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_parse_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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())
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:7,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:8,代码来源:test_regrtest.py
示例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)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:11,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:13,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:7,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:16,代码来源:test_regrtest.py
示例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")
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:7,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:7,代码来源:test_regrtest.py
示例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")
开发者ID:5outh,项目名称:Databases-Fall2014,代码行数:10,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:6,代码来源:test_regrtest.py
示例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)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
示例12: test_wait
def test_wait(self):
ns = regrtest._parse_args(['--wait'])
self.assertTrue(ns.wait)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:3,代码来源:test_regrtest.py
示例13: test_slaveargs
def test_slaveargs(self):
ns = regrtest._parse_args(['--slaveargs', '[[], {}]'])
self.assertEqual(ns.slaveargs, '[[], {}]')
self.checkError(['--slaveargs'], 'expected one argument')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:4,代码来源:test_regrtest.py
示例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'])
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:4,代码来源:test_regrtest.py
示例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')
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
示例16: test_arg
def test_arg(self):
ns = regrtest._parse_args(['foo'])
self.assertEqual(ns.args, ['foo'])
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:3,代码来源:test_regrtest.py
示例17: test_option_and_arg
def test_option_and_arg(self):
ns = regrtest._parse_args(['--quiet', 'foo'])
self.assertTrue(ns.quiet)
self.assertEqual(ns.verbose, 0)
self.assertEqual(ns.args, ['foo'])
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
示例18: test_randomize
def test_randomize(self):
for opt in '-r', '--randomize':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
self.assertTrue(ns.randomize)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
示例19: test_runleaks
def test_runleaks(self):
for opt in '-L', '--runleaks':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
self.assertTrue(ns.runleaks)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
示例20: test_slow
def test_slow(self):
for opt in '-o', '--slow':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
self.assertTrue(ns.print_slow)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_regrtest.py
注:本文中的test.regrtest._parse_args函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论