Browse Source

Merge "Don't request PR issue data"

changes/74/637974/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
b2826b2e9e
  1. 3
      tests/base.py
  2. 10
      tests/fakegithub.py
  3. 10
      zuul/driver/github/githubconnection.py

3
tests/base.py

@ -1096,7 +1096,8 @@ class FakeGithubPullRequest(object):
},
'sender': {
'login': 'ghuser'
}
},
'labels': [{'name': l} for l in self.labels]
}
return (name, data)

10
tests/fakegithub.py

@ -262,11 +262,6 @@ class FakeRepository(object):
return pulls
class FakeLabel(object):
def __init__(self, name):
self.name = name
class FakeIssue(object):
def __init__(self, fake_pull_request):
self._fake_pull_request = fake_pull_request
@ -274,10 +269,6 @@ class FakeIssue(object):
def pull_request(self):
return FakePull(self._fake_pull_request)
def labels(self):
return [FakeLabel(l)
for l in self._fake_pull_request.labels]
class FakeFile(object):
def __init__(self, filename):
@ -338,6 +329,7 @@ class FakePull(object):
'merged': pr.is_merged,
'body': pr.body,
'changed_files': len(pr.files),
'labels': [{'name': l} for l in pr.labels]
}
return data

10
zuul/driver/github/githubconnection.py

@ -1132,10 +1132,6 @@ class GithubConnection(BaseConnection):
self.log.warning("Pull request #%s of %s/%s returned None!" % (
number, owner, proj))
time.sleep(1)
# Get the issue obj so we can get the labels (this is silly)
# TODO: this may be able to be simplified after
# https://github.com/sigmavirus24/github3.py/issues/924
issueobj = probj.issue()
pr = probj.as_dict()
try:
pr['files'] = [f.filename for f in probj.files()]
@ -1147,10 +1143,8 @@ class GithubConnection(BaseConnection):
"via the merger: %s", exc)
pr['files'] = []
pr['labels'] = [l.name for l in issueobj.labels()]
self._sha_pr_cache.update(project_name, pr)
labels = [l['name'] for l in pr['labels']]
pr['labels'] = labels
log.debug('Got PR %s#%s', project_name, number)
self.log_rate_limit(self.log, github)
return (pr, probj)

Loading…
Cancel
Save