コード例 #1
0
 def setUp(self, get_default_logger):
     self.fetch_config = Mock()
     self.test_runner = Mock()
     self.logger = Mock()
     self.logs = []
     get_default_logger.return_value = Mock(info=self.logs.append)
     self.brunner = BisectRunner(self.fetch_config,
                                 self.test_runner,
                                 parse_args([]))
コード例 #2
0
ファイル: main.py プロジェクト: paked/mozregression
def cli(argv=None):
    """
    main entry point of mozregression command line.
    """
    options = parse_args(argv)
    logger = commandline.setup_logging("mozregression",
                                       options,
                                       {"mach": sys.stdout})

    if options.list_releases:
        print(formatted_valid_release_dates())
        sys.exit()

    cache_session = limitedfilecache.get_cache(
        options.http_cache_dir, limitedfilecache.ONE_GIGABYTE,
        logger=get_default_logger('Limited File Cache'))
    set_http_cache_session(cache_session,
                           get_defaults={"timeout": options.http_timeout})

    fetch_config = create_config(options.app, mozinfo.os, options.bits)

    if options.command is None:
        launcher_kwargs = dict(
            addons=options.addons,
            profile=options.profile,
            cmdargs=options.cmdargs,
        )
        test_runner = ManualTestRunner(fetch_config,
                                       persist=options.persist,
                                       launcher_kwargs=launcher_kwargs)
    else:
        test_runner = CommandTestRunner(fetch_config, options.command,
                                        persist=options.persist)

    runner = BisectRunner(fetch_config, test_runner, options)

    if fetch_config.is_inbound():
        # this can be useful for both inbound and nightly, because we
        # can go to inbound from nightly.
        fetch_config.set_inbound_branch(options.inbound_branch)

    if options.inbound:
        bisect = bisect_inbound
    else:
        bisect = bisect_nightlies
    try:
        launcher_class = APP_REGISTRY.get(fetch_config.app_name)
        launcher_class.check_is_runnable()

        sys.exit(bisect(runner, logger))
    except KeyboardInterrupt:
        sys.exit("\nInterrupted.")
    except UnavailableRelease as exc:
        sys.exit("%s\n%s" % (exc, formatted_valid_release_dates()))
    except MozRegressionError as exc:
        sys.exit(str(exc))