• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python libregrtest._parse_args函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test.libregrtest._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):
                 libregrtest._parse_args([opt])
             self.assertIn('Run Python regression tests.', out.getvalue())
开发者ID:grantjenks,项目名称:cpython,代码行数:7,代码来源:test_regrtest.py


示例2: test_failfast

 def test_failfast(self):
     for opt in "-G", "--failfast":
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, "-v"])
             self.assertTrue(ns.failfast)
             ns = libregrtest._parse_args([opt, "-W"])
             self.assertTrue(ns.failfast)
             self.checkError([opt], "-G/--failfast needs either -v or -W")
开发者ID:ChanChiChoi,项目名称:cpython,代码行数:8,代码来源:test_regrtest.py


示例3: test_verbose

 def test_verbose(self):
     ns = libregrtest._parse_args(["-v"])
     self.assertEqual(ns.verbose, 1)
     ns = libregrtest._parse_args(["-vvv"])
     self.assertEqual(ns.verbose, 3)
     ns = libregrtest._parse_args(["--verbose"])
     self.assertEqual(ns.verbose, 1)
     ns = libregrtest._parse_args(["--verbose"] * 3)
     self.assertEqual(ns.verbose, 3)
     ns = libregrtest._parse_args([])
     self.assertEqual(ns.verbose, 0)
开发者ID:ChanChiChoi,项目名称:cpython,代码行数:11,代码来源:test_regrtest.py


示例4: test_use

 def test_use(self):
     for opt in '-u', '--use':
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, 'gui,network'])
             self.assertEqual(ns.use_resources, ['gui', 'network'])
             ns = libregrtest._parse_args([opt, 'gui,none,network'])
             self.assertEqual(ns.use_resources, ['network'])
             expected = list(libregrtest.RESOURCE_NAMES)
             expected.remove('gui')
             ns = libregrtest._parse_args([opt, 'all,-gui'])
             self.assertEqual(ns.use_resources, expected)
             self.checkError([opt], 'expected one argument')
             self.checkError([opt, 'foo'], 'invalid resource')
开发者ID:M31MOTH,项目名称:cpython,代码行数:13,代码来源:test_regrtest.py


示例5: test_huntrleaks

 def test_huntrleaks(self):
     for opt in "-R", "--huntrleaks":
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, ":"])
             self.assertEqual(ns.huntrleaks, (5, 4, "reflog.txt"))
             ns = libregrtest._parse_args([opt, "6:"])
             self.assertEqual(ns.huntrleaks, (6, 4, "reflog.txt"))
             ns = libregrtest._parse_args([opt, ":3"])
             self.assertEqual(ns.huntrleaks, (5, 3, "reflog.txt"))
             ns = libregrtest._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:ChanChiChoi,项目名称:cpython,代码行数:15,代码来源:test_regrtest.py


示例6: test_fromfile

 def test_fromfile(self):
     for opt in '-f', '--fromfile':
         with self.subTest(opt=opt):
             ns = libregrtest._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:grantjenks,项目名称:cpython,代码行数:7,代码来源:test_regrtest.py


示例7: test_threshold

 def test_threshold(self):
     for opt in "-t", "--threshold":
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, "1000"])
             self.assertEqual(ns.threshold, 1000)
             self.checkError([opt], "expected one argument")
             self.checkError([opt, "foo"], "invalid int value")
开发者ID:ChanChiChoi,项目名称:cpython,代码行数:7,代码来源:test_regrtest.py


示例8: test_huntrleaks

 def test_huntrleaks(self):
     for opt in '-R', '--huntrleaks':
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, ':'])
             self.assertEqual(ns.huntrleaks, (5, 4, 'reflog.txt'))
             ns = libregrtest._parse_args([opt, '6:'])
             self.assertEqual(ns.huntrleaks, (6, 4, 'reflog.txt'))
             ns = libregrtest._parse_args([opt, ':3'])
             self.assertEqual(ns.huntrleaks, (5, 3, 'reflog.txt'))
             ns = libregrtest._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:grantjenks,项目名称:cpython,代码行数:16,代码来源:test_regrtest.py


示例9: test_coverdir

 def test_coverdir(self):
     for opt in '-D', '--coverdir':
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, 'foo'])
             self.assertEqual(ns.coverdir,
                              os.path.join(support.SAVEDCWD, 'foo'))
             self.checkError([opt], 'expected one argument')
开发者ID:grantjenks,项目名称:cpython,代码行数:7,代码来源:test_regrtest.py


示例10: test_nowindows

 def test_nowindows(self):
     for opt in '-n', '--nowindows':
         with self.subTest(opt=opt):
             with contextlib.redirect_stderr(io.StringIO()) as stderr:
                 ns = libregrtest._parse_args([opt])
             self.assertTrue(ns.nowindows)
             err = stderr.getvalue()
             self.assertIn('the --nowindows (-n) option is deprecated', err)
开发者ID:grantjenks,项目名称:cpython,代码行数:8,代码来源:test_regrtest.py


示例11: test_multiprocess

 def test_multiprocess(self):
     for opt in '-j', '--multiprocess':
         with self.subTest(opt=opt):
             ns = libregrtest._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")
开发者ID:ARK4579,项目名称:cpython,代码行数:9,代码来源:test_regrtest.py


示例12: test_match

    def test_match(self):
        for opt in '-m', '--match':
            with self.subTest(opt=opt):
                ns = libregrtest._parse_args([opt, 'pattern'])
                self.assertEqual(ns.match_tests, ['pattern'])
                self.checkError([opt], 'expected one argument')

        ns = libregrtest._parse_args(['-m', 'pattern1',
                                      '-m', 'pattern2'])
        self.assertEqual(ns.match_tests, ['pattern1', 'pattern2'])

        self.addCleanup(support.unlink, support.TESTFN)
        with open(support.TESTFN, "w") as fp:
            print('matchfile1', file=fp)
            print('matchfile2', file=fp)

        filename = os.path.abspath(support.TESTFN)
        ns = libregrtest._parse_args(['-m', 'match',
                                      '--matchfile', filename])
        self.assertEqual(ns.match_tests,
                         ['match', 'matchfile1', 'matchfile2'])
开发者ID:grantjenks,项目名称:cpython,代码行数:21,代码来源:test_regrtest.py


示例13: test_use

    def test_use(self):
        for opt in '-u', '--use':
            with self.subTest(opt=opt):
                ns = libregrtest._parse_args([opt, 'gui,network'])
                self.assertEqual(ns.use_resources, ['gui', 'network'])

                ns = libregrtest._parse_args([opt, 'gui,none,network'])
                self.assertEqual(ns.use_resources, ['network'])

                expected = list(libregrtest.ALL_RESOURCES)
                expected.remove('gui')
                ns = libregrtest._parse_args([opt, 'all,-gui'])
                self.assertEqual(ns.use_resources, expected)
                self.checkError([opt], 'expected one argument')
                self.checkError([opt, 'foo'], 'invalid resource')

                # all + a resource not part of "all"
                ns = libregrtest._parse_args([opt, 'all,tzdata'])
                self.assertEqual(ns.use_resources,
                                 list(libregrtest.ALL_RESOURCES) + ['tzdata'])

                # test another resource which is not part of "all"
                ns = libregrtest._parse_args([opt, 'extralargefile'])
                self.assertEqual(ns.use_resources, ['extralargefile'])
开发者ID:grantjenks,项目名称:cpython,代码行数:24,代码来源:test_regrtest.py


示例14: test_start

 def test_start(self):
     for opt in '-S', '--start':
         with self.subTest(opt=opt):
             ns = libregrtest._parse_args([opt, 'foo'])
             self.assertEqual(ns.start, 'foo')
             self.checkError([opt], 'expected one argument')
开发者ID:grantjenks,项目名称:cpython,代码行数:6,代码来源:test_regrtest.py


示例15: test_worker_args

 def test_worker_args(self):
     ns = libregrtest._parse_args(['--worker-args', '[[], {}]'])
     self.assertEqual(ns.worker_args, '[[], {}]')
     self.checkError(['--worker-args'], 'expected one argument')
开发者ID:grantjenks,项目名称:cpython,代码行数:4,代码来源:test_regrtest.py


示例16: test_wait

 def test_wait(self):
     ns = libregrtest._parse_args(['--wait'])
     self.assertTrue(ns.wait)
开发者ID:grantjenks,项目名称:cpython,代码行数:3,代码来源:test_regrtest.py


示例17: test_timeout

 def test_timeout(self):
     ns = libregrtest._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:grantjenks,项目名称:cpython,代码行数:5,代码来源:test_regrtest.py


示例18: checkError

 def checkError(self, args, msg):
     with support.captured_stderr() as err, self.assertRaises(SystemExit):
         libregrtest._parse_args(args)
     self.assertIn(msg, err.getvalue())
开发者ID:grantjenks,项目名称:cpython,代码行数:4,代码来源:test_regrtest.py


示例19: test_option_and_arg

 def test_option_and_arg(self):
     ns = libregrtest._parse_args(['--quiet', 'foo'])
     self.assertTrue(ns.quiet)
     self.assertEqual(ns.verbose, 0)
     self.assertEqual(ns.args, ['foo'])
开发者ID:grantjenks,项目名称:cpython,代码行数:5,代码来源:test_regrtest.py


示例20: test_arg

 def test_arg(self):
     ns = libregrtest._parse_args(['foo'])
     self.assertEqual(ns.args, ['foo'])
开发者ID:grantjenks,项目名称:cpython,代码行数:3,代码来源:test_regrtest.py



注:本文中的test.libregrtest._parse_args函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logger.TestLoggingHandler类代码示例发布时间:2022-05-27
下一篇:
Python util.gc_collect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap