当前位置: 首页>>代码示例>>Python>>正文


Python TestResultCollection.from_unittest_results方法代码示例

本文整理汇总了Python中moztest.results.TestResultCollection.from_unittest_results方法的典型用法代码示例。如果您正苦于以下问题:Python TestResultCollection.from_unittest_results方法的具体用法?Python TestResultCollection.from_unittest_results怎么用?Python TestResultCollection.from_unittest_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在moztest.results.TestResultCollection的用法示例。


在下文中一共展示了TestResultCollection.from_unittest_results方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from moztest.results import TestResultCollection [as 别名]
# 或者: from moztest.results.TestResultCollection import from_unittest_results [as 别名]
def main(args=sys.argv[1:]):

    # read the manifest
    if args:
        manifests = args
    else:
        manifests = [os.path.join(here, 'test-manifest.ini')]
    missing = []
    for manifest in manifests:
        # ensure manifests exist
        if not os.path.exists(manifest):
            missing.append(manifest)
    assert not missing, 'manifest%s not found: %s' % ((len(manifests) == 1 and '' or 's'), ', '.join(missing))
    manifest = manifestparser.TestManifest(manifests=manifests)

    # gather the tests
    tests = manifest.active_tests()
    unittestlist = []
    for test in tests:
        unittestlist.extend(unittests(test['path']))

    # run the tests
    suite = unittest.TestSuite(unittestlist)
    runner = unittest.TextTestRunner(verbosity=2) # default=1 does not show success of unittests
    unittest_results = runner.run(suite)
    results = TestResultCollection.from_unittest_results(None, unittest_results)

    # exit according to results
    sys.exit(1 if results.num_failures else 0)
开发者ID:Callek,项目名称:mozbase,代码行数:31,代码来源:test.py

示例2: main

# 需要导入模块: from moztest.results import TestResultCollection [as 别名]
# 或者: from moztest.results.TestResultCollection import from_unittest_results [as 别名]
def main(args=sys.argv[1:]):

    # parse command line options
    usage = '%prog [options] manifest.ini <manifest.ini> <...>'
    parser = optparse.OptionParser(usage=usage, description=__doc__)
    parser.add_option('-b', "--binary",
                      dest="binary", help="Binary path",
                      metavar=None, default=None)
    parser.add_option('--list', dest='list_tests',
                      action='store_true', default=False,
                      help="list paths of tests to be run")
    mozlog.commandline.add_logging_group(parser)
    options, args = parser.parse_args(args)
    logger = mozlog.commandline.setup_logging("mozbase", options,
                                              {"tbpl": sys.stdout})

    # read the manifest
    if args:
        manifests = args
    else:
        manifests = [os.path.join(here, 'test-manifest.ini')]
    missing = []
    for manifest in manifests:
        # ensure manifests exist
        if not os.path.exists(manifest):
            missing.append(manifest)
    assert not missing, 'manifest(s) not found: %s' % ', '.join(missing)
    manifest = manifestparser.TestManifest(manifests=manifests)

    if options.binary:
        # A specified binary should override the environment variable
        os.environ['BROWSER_PATH'] = options.binary

    # gather the tests
    tests = manifest.active_tests(disabled=False, **mozinfo.info)
    tests = [test['path'] for test in tests]
    logger.suite_start(tests)

    if options.list_tests:
        # print test paths
        print '\n'.join(tests)
        sys.exit(0)

    # create unittests
    unittestlist = []
    for test in tests:
        unittestlist.extend(unittests(test))

    # run the tests
    suite = unittest.TestSuite(unittestlist)
    runner = StructuredTestRunner(logger=logger)
    unittest_results = runner.run(suite)
    results = TestResultCollection.from_unittest_results(None, unittest_results)
    logger.suite_end()

    # exit according to results
    sys.exit(1 if results.num_failures else 0)
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:59,代码来源:test.py

示例3: main

# 需要导入模块: from moztest.results import TestResultCollection [as 别名]
# 或者: from moztest.results.TestResultCollection import from_unittest_results [as 别名]
def main(args=sys.argv[1:]):

    # parse command line options
    usage = '%prog [options] manifest.ini <manifest.ini> <...>'
    parser = optparse.OptionParser(usage=usage, description=__doc__)
    parser.add_option('--list', dest='list_tests',
                      action='store_true', default=False,
                      help="list paths of tests to be run")
    options, args = parser.parse_args(args)

    # read the manifest
    if args:
        manifests = args
    else:
        manifests = [os.path.join(here, 'test-manifest.ini')]
    missing = []
    for manifest in manifests:
        # ensure manifests exist
        if not os.path.exists(manifest):
            missing.append(manifest)
    assert not missing, 'manifest(s) not found: %s' % ', '.join(missing)
    manifest = manifestparser.TestManifest(manifests=manifests)

    # gather the tests
    tests = manifest.active_tests(disabled=False, **mozinfo.info)
    tests = [test['path'] for test in tests]
    if options.list_tests:
        # print test paths
        print '\n'.join(tests)
        sys.exit(0)

    # create unittests
    unittestlist = []
    for test in tests:
        unittestlist.extend(unittests(test))

    # run the tests
    suite = unittest.TestSuite(unittestlist)
    runner = unittest.TextTestRunner(verbosity=2) # default=1 does not show success of unittests
    unittest_results = runner.run(suite)
    results = TestResultCollection.from_unittest_results(None, unittest_results)

    # exit according to results
    sys.exit(1 if results.num_failures else 0)
开发者ID:AutomatedTester,项目名称:mozbase,代码行数:46,代码来源:test.py

示例4: main

# 需要导入模块: from moztest.results import TestResultCollection [as 别名]
# 或者: from moztest.results.TestResultCollection import from_unittest_results [as 别名]
def main(args=sys.argv[1:]):

    # read the manifest
    if args:
        manifests = args
    else:
        manifests = [os.path.join(here, 'manifest.ini')]
    missing = []
    for manifest_file in manifests:
        # ensure manifests exist
        if not os.path.exists(manifest_file):
            missing.append(manifest_file)
    assert not missing, 'manifest%s not found: %s' % (
        (len(manifests) == 1 and '' or 's'), ', '.join(missing))
    manifest = TestManifest(manifests=manifests)
    unittest_results = test_all(manifest)
    results = TestResultCollection.from_unittest_results(
        None, unittest_results)

    # exit according to results
    sys.exit(1 if results.num_failures else 0)
开发者ID:AutomatedTester,项目名称:mozdownload,代码行数:23,代码来源:test.py


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