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_invalid_date(self):
self.assertRaises(errors.DateFormatError, cli.parse_date, "invalid_format")
# test invalid buildid (43 is not a valid day)
self.assertRaises(errors.DateFormatError, cli.parse_date, "20151143030248")
def test_invalid_date(self):
self.assertRaises(errors.DateFormatError, utils.parse_date,
"invalid_format")
def test_invalid_release_tags(self):
with self.assertRaises(errors.UnavailableRelease):
tag_of_release("55.0.1.1")
with self.assertRaises(errors.UnavailableRelease):
tag_of_release("57.0b4")
with self.assertRaises(errors.UnavailableRelease):
tag_of_release("abc")
def test_get_erronous_cfg_defaults(self):
filepath = self._create_conf_file("aaaaaaaaaaa [Defaults]\n")
with self.assertRaises(errors.MozRegressionError):
cli.cli(conf_file=filepath)
def test_fetch_exception(self):
# fetching index 10 will raise an exception
self.build_data.raises_for_indexes[10] = 1
# that ends up in a DownloadError exception
self.assertRaises(errors.DownloadError, self.build_data.mid_point)
def test_find_build_info_check_changeset_error(self, push):
push.side_effect = errors.MozRegressionError
with self.assertRaises(errors.BuildInfoNotFound):
self.info_fetcher.find_build_info("123456789",)
push.assert_called_with("123456789")
if processor == "aarch64":
platform = r"win64-aarch64"
else:
platform = r"win64(-x86_64)?"
ext = r"\.zip"
else:
platform, ext = r"win32", r"\.zip"
elif os == "linux":
if bits == 64:
platform, ext = r"linux-x86_64", r"\.tar.bz2"
else:
platform, ext = r"linux-i686", r"\.tar.bz2"
elif os == "mac":
platform, ext = r"mac.*", r"\.dmg"
else:
raise errors.MozRegressionError(
"mozregression supports linux, mac and windows but your" " os is reported as '%s'." % os
)
# New taskcluster builds now just name the binary archive 'target', so
# that is added as one possibility in the regex.
regex = "(target|%s%s%s%s)" % (name, platprefix, platform, platsuffix)
if with_ext:
return "%s%s" % (regex, ext)
else:
return regex
def get_inbound_branch(self, date):
# sneaking this in here
if mozinfo.os == "win" and date < datetime.date(2010, 03, 18):
# no .zip package for Windows, can't use the installer
raise errors.WinTooOldBuildError()
if date < datetime.date(2008, 7, 26):
return "trunk"
elif date < datetime.date(2009, 1, 9):
return "comm-central"
elif date < datetime.date(2010, 8, 21):
return "comm-central-trunk"
else:
return "comm-central"
for i in builds_to_get:
future = self._create_fetch_task(executor, i)
futures_results[future] = i
for future in futures.as_completed(futures_results):
i = futures_results[future]
exc = future.exception()
if exc is not None:
must_raise = True
if isinstance(exc, requests.HTTPError):
if nb_try < max_try:
self._logger.warning(
"Got HTTPError - retrying")
self._logger.warning(exc)
must_raise = False
if must_raise:
raise errors.DownloadError(
"Retrieving valid builds from %r generated an"
" exception: %s" % (self._cache[i][1],
exc))
else:
builds_to_get.remove(i)
self._set_data(i, future.result())
self.filter_invalid_builds()
self._logger.debug("Now we got %d folders - %d were bad"
% (len(self), size - len(self)))