How to use mozregression - 10 common examples

To help you get started, we’ve selected a few mozregression examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / mozregression / tests / unit / test_bisector.py View on Github external
self.assertIn("from [12, 12345] (4 builds)", log[0])
        self.assertIn("to [1234, 12345] (2 builds)", log[0])
        self.assertIn("1 steps left", log[0])

    @patch("mozregression.bisector.LOG")
    def test_user_exit(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_revision = "3"
        self.handler.bad_revision = "1"
        self.handler.user_exit(0)
        self.assertEqual("Newest known good integration revision: 3", log[0])
        self.assertEqual("Oldest known bad integration revision: 1", log[1])


class MyBuildData(build_range.BuildRange):
    def __init__(self, data=()):
        class FutureBuildInfo(build_range.FutureBuildInfo):
            def __init__(self, *a, **kwa):
                build_range.FutureBuildInfo.__init__(self, *a, **kwa)
                self._build_info = Mock(data=self.data)

        build_range.BuildRange.__init__(self, None, [FutureBuildInfo(None, v) for v in data])

    def __repr__(self):
        return repr([s.build_info.data for s in self._future_build_infos])

    def __eq__(self, other):
        return [s.build_info.data for s in self._future_build_infos] == [
            s.build_info.data for s in other._future_build_infos
        ]
github mozilla / mozregression / tests / unit / test_utils.py View on Github external
def test_valid_formatted_release_dates(self):
        formatted_output = utils.formatted_valid_release_dates()
        firefox_releases = utils.releases()

        for line in formatted_output.splitlines():
            if "Valid releases: " in line:
                continue

            fields = line.translate(None, " ").split(":")
            version = int(fields[0])
            date = fields[1]
            self.assertTrue(firefox_releases.has_key(version))
            self.assertEquals(date, firefox_releases[version])
github mozilla / mozregression / tests / unit / test_main.py View on Github external
def test_app_bisect_integration_user_exit(create_app, mocker):
    Handler = mocker.patch("mozregression.main.IntegrationHandler")
    Handler.return_value = Mock(
        build_range=[Mock(repo_name="mozilla-central")],
        good_revision="c1",
        bad_revision="c2",
        spec=IntegrationHandler,
    )

    app = create_app(["--good=c1", "--bad=c2"])
    app.bisector.bisect = Mock(return_value=Bisection.USER_EXIT)
    assert app.bisect_integration() == 0
    assert create_app.find_in_log("To resume, run:")
    assert create_app.find_in_log("--repo=mozilla-central", False)
github mozilla / mozregression / tests / unit / test_fetch_build_info.py View on Github external
def setUp(self):
        fetch_config = fetch_configs.create_config("firefox", "linux", 64, "x86_64")
        self.info_fetcher = fetch_build_info.InfoFetcher(fetch_config)
github mozilla / mozregression / tests / unit / test_build_range.py View on Github external
def test_get_integration_range_with_expand(mocker):
    fetch_config = create_config("firefox", "linux", 64, "x86_64")
    jpush_class = mocker.patch("mozregression.fetch_build_info.JsonPushes")
    pushes = [create_push("b", 1), create_push("d", 2), create_push("f", 3)]
    jpush = mocker.Mock(pushes_within_changes=mocker.Mock(return_value=pushes), spec=JsonPushes)
    jpush_class.return_value = jpush

    check_expand = mocker.patch("mozregression.build_range.BuildRange.check_expand")

    build_range.get_integration_range(fetch_config, "a", "e", expand=10)

    check_expand.assert_called_once_with(
        10, build_range.tc_range_before, build_range.tc_range_after, interrupt=None
    )
github mozilla / mozregression / tests / unit / test_build_data.py View on Github external
def create_inbound_build_data(self, good, bad, get_pushlogs):
        fetch_config = fetch_configs.create_config('firefox', 'linux', 64)
        # create fake pushlog returns
        pushlogs = [
            {'date': d, 'changesets': ['c' + str(d)]}
            for d in xrange(int(good[1:]), int(bad[1:]))
        ]
        get_pushlogs.return_value = pushlogs
        # returns 100 possible build folders

        return build_data.InboundBuildData(fetch_config, good, bad)
github mozilla / mozregression / tests / unit / test_build_info.py View on Github external
def create_build_info(klass, **attrs):
    defaults = dict(
        fetch_config=create_config("firefox", "linux", 64, "x86_64"),
        build_url="http://build/url",
        build_date=date(2015, 9, 1),
        changeset="12ab" * 10,
        repo_url="http://repo:url",
    )
    defaults.update(attrs)
    return klass(**defaults)
github mozilla / mozregression / tests / unit / test_fetch_configs.py View on Github external
def test_jsshell_x86_64_build_regex():
    conf = create_config("jsshell", "win", 64, "x86_64")
    assert not re.match(conf.build_regex(), "jsshell-win64-aarch64.zip")
github mozilla / mozregression / tests / unit / test_build_range.py View on Github external
def test_get_integration_range(mocker):
    fetch_config = create_config("firefox", "linux", 64, "x86_64")
    jpush_class = mocker.patch("mozregression.fetch_build_info.JsonPushes")
    pushes = [create_push("b", 1), create_push("d", 2), create_push("f", 3)]
    jpush = mocker.Mock(pushes_within_changes=mocker.Mock(return_value=pushes), spec=JsonPushes)
    jpush_class.return_value = jpush

    b_range = build_range.get_integration_range(fetch_config, "a", "e")

    jpush_class.assert_called_once_with(branch="mozilla-central")
    jpush.pushes_within_changes.assert_called_once_with("a", "e")
    assert isinstance(b_range, build_range.BuildRange)
    assert len(b_range) == 3

    b_range.build_info_fetcher.find_build_info = lambda v: v
    assert b_range[0] == pushes[0]
    assert b_range[1] == pushes[1]
    assert b_range[2] == pushes[2]
github mozilla / mozregression / tests / unit / test_fetch_configs.py View on Github external
def test_tk_route(app, os, bits, processor, repo, push_date, expected):
    conf = create_config(app, os, bits, processor)
    conf.set_repo(repo)
    result = conf.tk_route(create_push(CHSET, push_date))
    assert result == expected