Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
fetch_config = fetch_configs.create_config("firefox", "linux", 64, "x86_64")
self.info_fetcher = fetch_build_info.InfoFetcher(fetch_config)
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
)
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)
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)
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")
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]
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
def test_get_nightly_range_datetime(start, end, range_size):
fetch_config = create_config("firefox", "linux", 64, "x86_64")
b_range = build_range.get_nightly_range(fetch_config, start, end)
assert isinstance(b_range, build_range.BuildRange)
assert len(b_range) == range_size
b_range.build_info_fetcher.find_build_info = lambda v: v
assert b_range[0] == start
assert b_range[-1] == end
# between, we only have date instances
for i in range(1, range_size - 1):
assert isinstance(b_range[i], date)
def get_app():
default_bad_date = str(datetime.date.today())
default_good_date = "2009-01-01"
options = parse_args()
logger = commandline.setup_logging("mozregression", options, {"mach": sys.stdout})
fetch_config = create_config(options.app, mozinfo.os, options.bits)
if fetch_config.is_inbound():
# this can be useful for both inbound and nightly, because we
# can go to inbound from nightly.
fetch_config.set_inbound_branch(options.inbound_branch)
cacheSession = limitedfilecache.get_cache(
options.http_cache_dir, one_gigabyte,
logger=get_default_logger('Limited File Cache'))
set_http_cache_session(cacheSession)
if options.inbound:
if not fetch_config.is_inbound():
sys.exit('Unable to bissect inbound for `%s`' % fetch_config.app_name)
if not options.last_good_revision or not options.first_bad_revision: