本文整理汇总了Python中mozregression.json_pushes.JsonPushes类的典型用法代码示例。如果您正苦于以下问题:Python JsonPushes类的具体用法?Python JsonPushes怎么用?Python JsonPushes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JsonPushes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_pushes_within_changes
def test_pushes_within_changes(mocker):
push_first = {'1': {'changesets': ['a']}}
other_pushes = {
'2': {'changesets': ['b']},
'3': {'changesets': ['c']}
}
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
response = Mock(json=Mock(side_effect=[push_first, other_pushes]))
retry_get.return_value = response
jpushes = JsonPushes()
pushes = jpushes.pushes_within_changes('fromchset', "tochset")
assert pushes[0].push_id == '1'
assert pushes[0].changeset == 'a'
assert pushes[1].push_id == '2'
assert pushes[1].changeset == 'b'
assert pushes[2].push_id == '3'
assert pushes[2].changeset == 'c'
retry_get.assert_has_calls([
call('https://hg.mozilla.org/integration/mozilla-inbound/json-pushes'
'?changeset=fromchset'),
call().raise_for_status(),
call().json(),
call('https://hg.mozilla.org/integration/mozilla-inbound/json-pushes'
'?fromchange=fromchset&tochange=tochset'),
call().raise_for_status(),
call().json()
])
开发者ID:EricRahm,项目名称:mozregression,代码行数:31,代码来源:test_json_pushes.py
示例2: check_for_move
def check_for_move(self, repo, changeset):
"""
Checks if the warning has moved lines but still exists.
"""
if self.ignore_lines:
return False
files = retrieve_test_logs(
repo, changeset[:12],
self.platform, warning_re=self.warning_re)
combined_warnings = Counter()
for log in files:
if log:
combined_warnings.update(log.warnings)
possible_move_found = False
normalized = re.match(r'^(.*), line [0-9]+$', self.warning).group(1)
for (k, v) in combined_warnings.iteritems():
if k.startswith(normalized) and v > self.warning_limit:
print "Possible line move:\n %d - %s" % (v, k)
possible_move_found = True
if possible_move_found:
jp = JsonPushes(repo)
push = jp.push(changeset)
print "Try this date: %s" % push.utc_date
return possible_move_found
开发者ID:EricRahm,项目名称:log-spam-hell,代码行数:30,代码来源:bisect.py
示例3: test_pushlog_for_change
def test_pushlog_for_change(mocker):
pushlog = {"a": "b"}
retry_get = mocker.patch("mozregression.json_pushes.retry_get")
response = Mock(json=Mock(return_value={"1": pushlog}))
retry_get.return_value = response
jpushes = JsonPushes()
assert jpushes.pushlog_for_change("validchangeset") == pushlog
开发者ID:KWierso,项目名称:mozregression,代码行数:8,代码来源:test_json_pushes.py
示例4: test_pushlog_for_change_404_error
def test_pushlog_for_change_404_error(mocker):
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
response = Mock(status_code=404)
retry_get.return_value = response
jpushes = JsonPushes()
with pytest.raises(MozRegressionError):
jpushes.pushlog_for_change('invalid_changeset')
开发者ID:GopianiS,项目名称:mozregression,代码行数:8,代码来源:test_json_pushes.py
示例5: test_pushlog_for_change_nothing_found
def test_pushlog_for_change_nothing_found(mocker):
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
response = Mock(json=Mock(return_value={}))
retry_get.return_value = response
jpushes = JsonPushes()
with pytest.raises(MozRegressionError):
jpushes.pushlog_for_change('invalid_changeset')
开发者ID:GopianiS,项目名称:mozregression,代码行数:8,代码来源:test_json_pushes.py
示例6: _bisect_inbounds
def _bisect_inbounds(self, good_rev, bad_rev, ensure_good_and_bad=False,
expand=0):
LOG.info("Getting %s builds between %s and %s"
% (self.fetch_config.inbound_branch, good_rev, bad_rev))
handler = InboundHandler(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 inbound 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:
branch, good_rev, bad_rev = result
self.fetch_config.set_repo(branch)
return self._bisect_inbounds(good_rev, bad_rev,
expand=DEFAULT_EXPAND)
else:
# This code is broken, it prints out the message even when
# there are multiple bug numbers or commits in the range.
# Somebody should fix it before re-enabling it.
return 0
# print a bug if:
# (1) there really is only one bad push (and we're not
# just missing the builds for some intermediate builds)
# (2) there is only one bug number in that push
jp = JsonPushes(handler.build_range[1].repo_name)
num_pushes = len(jp.pushes_within_changes(
handler.build_range[0].changeset,
handler.build_range[1].changeset))
if num_pushes == 2:
bugids = find_bugids_in_push(
handler.build_range[1].repo_name,
handler.build_range[1].changeset
)
if len(bugids) == 1:
word = 'fix' if handler.find_fix else 'regression'
LOG.info("Looks like the following bug has the "
" changes which introduced the"
" {}:\n{}".format(word,
bug_url(bugids[0])))
elif result == Bisection.USER_EXIT:
self._print_resume_info(handler)
else:
# NO_DATA. With inbounds, this can not happen if changesets
# are incorrect - so builds are probably too old
LOG.info(
'There are no build artifacts on inbound for these'
' changesets (they are probably too old).')
return 1
return 0
开发者ID:mozilla,项目名称:mozregression,代码行数:58,代码来源:main.py
示例7: handle_merge
def handle_merge(self):
# let's check if we are facing a merge, and in that case,
# continue the bisection from the merged branch.
result = None
LOG.debug("Starting merge handling...")
# we have to check the commit of the most recent push
most_recent_push = self.build_range[1]
jp = JsonPushes(most_recent_push.repo_name)
push = jp.push(most_recent_push.changeset, full='1')
msg = push.changeset['desc']
LOG.debug("Found commit message:\n%s\n" % msg)
branch = find_branch_in_merge_commit(msg)
if not (branch and len(push.changesets) >= 2):
return
try:
# so, this is a merge. We can find the oldest and youngest
# changesets, and the branch where the merge comes from.
oldest = push.changesets[0]['node']
# exclude the merge commit
youngest = push.changesets[-2]['node']
LOG.debug("This is a merge from %s" % branch)
# we can't use directly the youngest changeset because we
# don't know yet if it is good.
#
# PUSH1 PUSH2
# [1 2] [3 4 5 6 7]
# G MERGE B
#
# so first, grab it. This needs to be done on the right branch.
jp2 = JsonPushes(branch)
raw = [int(p.push_id) for p in
jp2.pushes_within_changes(oldest, youngest)]
data = jp2.pushes(
startID=str(min(raw) - 2),
endID=str(max(raw)),
)
oldest = data[0].changesets[0]
youngest = data[-1].changesets[-1]
# we are ready to bisect further
LOG.info("************* Switching to %s" % branch)
gr, br = self._reverse_if_find_fix(oldest, youngest)
result = (branch, gr, br)
except MozRegressionError:
LOG.debug("Got exception", exc_info=True)
raise MozRegressionError(
"Unable to exploit the merge commit. Origin branch is {}, and"
" the commit message for {} was:\n{}".format(
most_recent_push.repo_name,
most_recent_push.short_changeset,
msg
)
)
LOG.debug('End merge handling')
return result
开发者ID:crisron,项目名称:mozregression-1,代码行数:58,代码来源:bisector.py
示例8: test_revision_for_date_raise_appropriate_error
def test_revision_for_date_raise_appropriate_error():
jpushes = JsonPushes(branch='inbound')
jpushes.pushlog_within_changes = Mock(side_effect=EmptyPushlogError)
with pytest.raises(EmptyPushlogError) as ctx:
jpushes.revision_for_date(date(2015, 1, 1))
assert str(ctx.value) == \
'No pushes available for the date 2015-01-01 on inbound.'
开发者ID:GopianiS,项目名称:mozregression,代码行数:9,代码来源:test_json_pushes.py
示例9: find_bugids_in_push
def find_bugids_in_push(branch, changeset):
jp = JsonPushes(branch)
push = jp.push(changeset, full='1')
branches = set()
for chset in push.changesets:
res = RE_BUG_ID.search(chset['desc'])
if res:
branches.add(res.group(1))
return [b for b in branches]
开发者ID:EricRahm,项目名称:mozregression,代码行数:9,代码来源:bugzilla.py
示例10: test_pushlog_within_changes
def test_pushlog_within_changes(mocker):
push_first = {"1": {"date": 1}}
other_pushes = {"2": {"date": 2}, "3": {"date": 3}}
retry_get = mocker.patch("mozregression.json_pushes.retry_get")
response = Mock(json=Mock(side_effect=[push_first, other_pushes]))
retry_get.return_value = response
jpushes = JsonPushes()
assert jpushes.pushlog_within_changes("fromchset", "tochset") == [{"date": 1}, {"date": 2}, {"date": 3}]
开发者ID:KWierso,项目名称:mozregression,代码行数:10,代码来源:test_json_pushes.py
示例11: range_for_inbounds
def range_for_inbounds(fetch_config, start_rev, end_rev):
"""
Creates a BuildRange for inbounds builds.
"""
info_fetcher = InboundInfoFetcher(fetch_config)
pushlogs_finder = JsonPushes(branch=fetch_config.inbound_branch)
pushlogs = pushlogs_finder.pushlog_within_changes(start_rev, end_rev)
futures_builds = []
for pushlog in pushlogs:
changeset = pushlog['changesets'][-1]
futures_builds.append(FutureBuildInfo(info_fetcher, changeset))
return BuildRange(info_fetcher, futures_builds)
开发者ID:mshal,项目名称:mozregression,代码行数:14,代码来源:build_range.py
示例12: __init__
def __init__(self, fetch_config):
InfoFetcher.__init__(self, fetch_config)
options = fetch_config.tk_options()
self.index = taskcluster.client.Index(options)
self.queue = taskcluster.Queue(options)
self.jpushes = JsonPushes(branch=fetch_config.inbound_branch,
path=fetch_config.branch_path)
开发者ID:pombredanne,项目名称:mozregression,代码行数:7,代码来源:fetch_build_info.py
示例13: test_pushlog_within_changes_using_dates
def test_pushlog_within_changes_using_dates():
p1 = {'changesets': ['abc'], 'date': 12345}
p2 = {'changesets': ['def'], 'date': 67891}
pushes = {'1': p1, '2': p2}
jpushes = JsonPushes(branch='m-i')
jpushes._request = Mock(return_value=pushes)
assert jpushes.pushlog_within_changes(
date(2015, 1, 1), date(2015, 2, 2)
) == [p1, p2]
jpushes._request.assert_called_once_with(
'https://hg.mozilla.org/integration/mozilla-inbound/json-pushes?'
'startdate=2015-01-01&enddate=2015-02-03'
)
开发者ID:GopianiS,项目名称:mozregression,代码行数:17,代码来源:test_json_pushes.py
示例14: test_pushes_within_changes_using_dates
def test_pushes_within_changes_using_dates(mocker):
p1 = {'changesets': ['abc'], 'date': 12345}
p2 = {'changesets': ['def'], 'date': 67891}
pushes = {'1': p1, '2': p2}
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
retry_get.return_value = Mock(json=Mock(return_value=pushes))
jpushes = JsonPushes(branch='m-i')
pushes = jpushes.pushes_within_changes(date(2015, 1, 1), date(2015, 2, 2))
assert pushes[0].push_id == '1'
assert pushes[1].push_id == '2'
retry_get.assert_called_once_with(
'https://hg.mozilla.org/integration/mozilla-inbound/json-pushes?'
'startdate=2015-01-01&enddate=2015-02-03'
)
开发者ID:EricRahm,项目名称:mozregression,代码行数:18,代码来源:test_json_pushes.py
示例15: _choose_integration_branch
def _choose_integration_branch(self, changeset):
"""
Tries to determine which integration branch the given changeset
originated from by checking the date the changeset first showed up
in each repo. The repo with the earliest date is chosen.
"""
landings = {}
for k in ("autoland", "mozilla-inbound"):
jp = JsonPushes(k)
try:
push = jp.push(changeset, full='1')
landings[k] = push.timestamp
except EmptyPushlogError:
LOG.debug("Didn't find %s in %s" % (changeset, k))
repo = min(landings, key=landings.get)
return repo
开发者ID:wlach,项目名称:mozregression,代码行数:18,代码来源:bisector.py
示例16: check_taskcluster
def check_taskcluster(options, fetch_config, logger):
if not options.taskcluster or not options.artifact_name:
raise MozRegressionError('--taskcluster and --artifact-name are'
' required for taskcluster regression'
' finding')
if options.repo and options.inbound_branch:
raise MozRegressionError('unable to define both --repo and'
' --inbound-branch for b2g-device')
if options.repo:
# if repo is defined, use that to bisect using taskcluster,
# ie the "inbound way" for now. Just remove the "integration"
# branch path.
fetch_config.set_branch_path(None)
fetch_config.set_inbound_branch(options.repo)
if options.last_good_revision and options.first_bad_revision:
# If we have revisions, use those
check_inbounds(options, fetch_config, logger)
print "Using revs: %s - %s" % (
options.last_good_revision,
options.first_bad_revision,
)
else:
# If we don't have revisions, use the nightly-style date range and
# convert it into a good/bad rev.
check_nightlies(options, fetch_config, logger)
from mozregression.json_pushes import JsonPushes
jpushes = JsonPushes(branch=fetch_config.inbound_branch,
path=fetch_config.branch_path)
options.last_good_revision = jpushes.revision_for_date(
options.good_date
)
options.first_bad_revision = jpushes.revision_for_date(
options.bad_date,
last=True
)
print "Using good rev %s for date %s" % (
options.last_good_revision,
options.good_date
)
print "Using bad rev %s for date %s" % (
options.first_bad_revision,
options.bad_date
)
开发者ID:ShakoHo,项目名称:mozregression,代码行数:44,代码来源:cli.py
示例17: test_push
def test_push(mocker):
pushlog = {'1': {
'changesets': ['a', 'b', 'c'],
'date': 123456,
}}
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
response = Mock(json=Mock(return_value=pushlog))
retry_get.return_value = response
jpushes = JsonPushes()
push = jpushes.push('validchangeset')
assert isinstance(push, Push)
assert push.push_id == '1'
assert push.changeset == 'c'
assert push.changesets[0] == 'a'
assert push.timestamp == 123456
assert push.utc_date == datetime(1970, 1, 2, 10, 17, 36)
assert str(push) == 'c'
retry_get.assert_called_once_with(
'https://hg.mozilla.org/integration/mozilla-inbound/json-pushes'
'?changeset=validchangeset'
)
开发者ID:EricRahm,项目名称:mozregression,代码行数:22,代码来源:test_json_pushes.py
示例18: test_pushlog_within_changes
def test_pushlog_within_changes(mocker):
push_first = {'1': {'date': 1}}
other_pushes = {
'2': {'date': 2},
'3': {'date': 3}
}
retry_get = mocker.patch('mozregression.json_pushes.retry_get')
response = Mock(json=Mock(side_effect=[push_first, other_pushes]))
retry_get.return_value = response
jpushes = JsonPushes()
assert jpushes.pushlog_within_changes('fromchset', "tochset") == [
{'date': 1}, {'date': 2}, {'date': 3}
]
# raw should include push ids in the result
response = Mock(json=Mock(side_effect=[push_first, other_pushes]))
retry_get.return_value = response
assert jpushes.pushlog_within_changes(
'fromchset', "tochset", raw=True
) == dict(push_first.items() + other_pushes.items())
开发者ID:GopianiS,项目名称:mozregression,代码行数:23,代码来源:test_json_pushes.py
示例19: InboundInfoFetcher
class InboundInfoFetcher(InfoFetcher):
def __init__(self, fetch_config):
InfoFetcher.__init__(self, fetch_config)
options = fetch_config.tk_options()
self.index = taskcluster.Index(options)
self.queue = taskcluster.Queue(options)
self.jpushes = JsonPushes(branch=fetch_config.inbound_branch)
def find_build_info(self, push):
"""
Find build info for an inbound build, given a Push, a changeset or a
date/datetime.
if `push` is not an instance of Push (e.g. it is a date, datetime, or
string representing the changeset), a query to json pushes will be
done.
Return a :class:`InboundBuildInfo` instance.
"""
if not isinstance(push, Push):
try:
push = self.jpushes.push(push)
except MozRegressionError, exc:
raise BuildInfoNotFound(str(exc))
changeset = push.changeset
tk_routes = self.fetch_config.tk_inbound_routes(push)
try:
task_id = None
stored_failure = None
for tk_route in tk_routes:
LOG.debug('using taskcluster route %r' % tk_route)
try:
task_id = self.index.findTask(tk_route)['taskId']
except TaskclusterFailure as ex:
LOG.debug('nothing found via route %r' % tk_route)
stored_failure = ex
continue
if task_id:
status = self.queue.status(task_id)['status']
break
if not task_id:
raise stored_failure
except TaskclusterFailure:
raise BuildInfoNotFound("Unable to find build info using the"
" taskcluster route %r" %
self.fetch_config.tk_inbound_route(push))
# find a completed run for that task
run_id, build_date = None, None
for run in reversed(status['runs']):
if run['state'] == 'completed':
run_id = run['runId']
build_date = datetime.strptime(run["resolved"],
'%Y-%m-%dT%H:%M:%S.%fZ')
break
if run_id is None:
raise BuildInfoNotFound("Unable to find completed runs for task %s"
% task_id)
artifacts = self.queue.listArtifacts(task_id, run_id)['artifacts']
# look over the artifacts of that run
build_url = None
for a in artifacts:
name = os.path.basename(a['name'])
if self.build_regex.search(name):
meth = self.queue.buildUrl
if self.fetch_config.tk_needs_auth():
meth = self.queue.buildSignedUrl
build_url = meth('getArtifact', task_id, run_id, a['name'])
break
if build_url is None:
raise BuildInfoNotFound("unable to find a build url for the"
" changeset %r" % changeset)
return InboundBuildInfo(
self.fetch_config,
build_url=build_url,
build_date=build_date,
changeset=changeset,
repo_url=self.jpushes.repo_url,
task_id=task_id,
)
开发者ID:mozilla,项目名称:mozregression,代码行数:84,代码来源:fetch_build_info.py
示例20: test_json_pushes_url
def test_json_pushes_url(branch, chsetskwargs, result_url):
jpushes = JsonPushes(branch=branch)
assert jpushes.json_pushes_url(**chsetskwargs) == result_url
开发者ID:GopianiS,项目名称:mozregression,代码行数:3,代码来源:test_json_pushes.py
注:本文中的mozregression.json_pushes.JsonPushes类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论