Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
def setUp(self):
self.handler = IntegrationHandler()
def bisect_further(self):
assert self.bisection
self.started.emit()
handler = self.bisection.handler
try:
nhandler = IntegrationHandler(find_fix=self.bisection.handler.find_fix)
Bisector.bisect(
self,
nhandler,
handler.good_revision,
handler.bad_revision,
expand=DEFAULT_EXPAND,
interrupt=self.should_stop.is_set,
)
except MozRegressionError:
self._finish_on_exception(None)
except StopIteration:
self.finished.emit(None, Bisection.USER_EXIT)
def _bisect_integration(self, good_rev, bad_rev, ensure_good_and_bad=False, expand=0):
LOG.info(
"Getting %s builds between %s and %s"
% (self.fetch_config.integration_branch, good_rev, bad_rev)
)
handler = IntegrationHandler(
find_fix=self.options.find_fix, ensure_good_and_bad=ensure_good_and_bad
)
result = self._do_bisect(handler, good_rev, bad_rev, expand=expand)
if result == Bisection.FINISHED:
LOG.info("No more integration revisions, bisection finished.")
handler.print_range()
if handler.good_revision == handler.bad_revision:
LOG.warning(
"It seems that you used two changesets that are in"
" the same push. Check the pushlog url."
)
elif len(handler.build_range) == 2:
# range reduced to 2 pushes (at least ones with builds):
# one good, one bad.
result = handler.handle_merge()
if result:
def init_worker(self, fetch_config, options):
AbstractBuildRunner.init_worker(self, fetch_config, options)
self.worker.test_runner.evaluate_started.connect(self.evaluate)
self.worker.finished.connect(self.bisection_finished)
self.worker.handle_merge.connect(self.handle_merge)
self.worker.choose_next_build.connect(self.choose_next_build)
good, bad = options.get("good"), options.get("bad")
if (
is_date_or_datetime(good)
and is_date_or_datetime(bad)
and fetch_config.should_use_archive()
):
handler = NightlyHandler(find_fix=options["find_fix"])
else:
handler = IntegrationHandler(find_fix=options["find_fix"])
self.worker._bisect_args = (handler, good, bad)
self.worker.download_in_background = self.global_prefs["background_downloads"]
if self.global_prefs["approx_policy"]:
self.worker.approx_chooser = ApproxPersistChooser(7)
return self.worker.bisect