Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
]
def create_build_range(values):
info_fetcher = None # we should not need to access it
data = []
for v in values:
data.append(build_range.FutureBuildInfo(info_fetcher, v))
return build_range.BuildRange(info_fetcher, data)
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]
b_range.future_build_infos[0].date_or_changeset() == "b"
def _build_range(fb, rng):
return build_range.BuildRange(
fb.build_info_fetcher, [build_range.FutureBuildInfo(fb.build_info_fetcher, i) for i in rng],
)
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])
)
== QMessageBox.Yes
):
evt.accept()
else:
evt.ignore()
if __name__ == "__main__":
from mozregression.build_range import BuildRange, FutureBuildInfo
class FInfo(FutureBuildInfo):
def _fetch(self):
return self.data
build_range = BuildRange(None, [FInfo(None, i) for i in range(420)])
from PySide2.QtWidgets import QApplication, QMainWindow
app = QApplication([])
win = QMainWindow()
dlg = SkipDialog(build_range)
if to_datetime(obj) < time_limit:
LOG.info(
"TaskCluster only keeps builds for one year."
" Using %s instead of %s." % (time_limit, obj)
)
obj = time_limit
return obj
start_rev = _check_date(start_rev)
end_rev = _check_date(end_rev)
futures_builds = [
TCFutureBuildInfo(info_fetcher, push)
for push in jpushes.pushes_within_changes(start_rev, end_rev)
]
br = BuildRange(info_fetcher, futures_builds)
if expand > 0:
br.check_expand(expand, tc_range_before, tc_range_after, interrupt=interrupt)
return br