Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, *a, **kwa):
build_range.FutureBuildInfo.__init__(self, *a, **kwa)
self._build_info = Mock(data=self.data)
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 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_tc_range_before_after(mocker, func, start, size, expected_range):
ftc = build_range.FutureBuildInfo(mocker.Mock(), mocker.Mock(push_id=start))
def pushes(startID, endID):
# startID: greaterThan - endID: up to and including
# http://mozilla-version-control-tools.readthedocs.org/en/latest/hgmo/pushlog.html#query-parameters # noqa
return list(range(startID + 1, endID + 1))
ftc.build_info_fetcher.jpushes.pushes.side_effect = pushes
rng = func(ftc, size)
assert len(rng) == size
assert [rng.get_future(i).data for i in range(len(rng))] == expected_range
def get_nightly_range(fetch_config, start_date, end_date, expand=0, interrupt=None):
"""
Creates a BuildRange for nightlies.
"""
info_fetcher = NightlyInfoFetcher(fetch_config)
futures_builds = []
# build the build range using only dates
sd = to_date(start_date)
for i in range((to_date(end_date) - sd).days + 1):
futures_builds.append(FutureBuildInfo(info_fetcher, sd + datetime.timedelta(days=i)))
# and now put back the real start and end dates
# in case they were datetime instances (coming from buildid)
futures_builds[0].data = start_date
futures_builds[-1].data = end_date
return BuildRange(info_fetcher, futures_builds)
"Closing this dialog will end the bisection. Are you sure"
" you want to end the bisection now ?",
QMessageBox.Yes | QMessageBox.No,
QMessageBox.No,
)
== 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)