コード例 #1
0
ファイル: test.py プロジェクト: Callek/mozbase
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)
コード例 #2
0
ファイル: test.py プロジェクト: kls88/Spidermonkey
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)
コード例 #3
0
ファイル: test.py プロジェクト: martapiekarska/gecko
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")
    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)

    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]
    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
        resultclass=TBPLTextTestResult)
    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)
コード例 #4
0
ファイル: test.py プロジェクト: MichaelKohler/gecko-dev
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)
コード例 #5
0
ファイル: test.py プロジェクト: AutomatedTester/mozbase
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)
コード例 #6
0
ファイル: test.py プロジェクト: AutomatedTester/mozdownload
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)
コード例 #7
0
ファイル: test.py プロジェクト: AutomatedTester/mozdownload
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)