Commit a6f1c85b4620c06882bf52f9ead9d668ae30d241

Authored by Loic Dachary
1 parent 80e14da2

tests: fixture_github must retry when creating a pull request

Pull request creation is subject to undocumented quotas and may fail
with, for instance:

"submitted too quickly after a previous comment "

Signed-off-by: Loic Dachary <loic@dachary.org>
Showing 1 changed file with 14 additions and 5 deletions
... ... @@ -100,11 +100,20 @@ class FixtureGitHub(object):
100 100 base=base))
101 101 shutil.rmtree(d)
102 102 repos = self.github.g.repos(GITHUB['username'])(GITHUB['repo'])
103   - pr = repos.pulls().post(
104   - title=name,
105   - base=base,
106   - body=body,
107   - head='wip-' + name)
  103 + retry = 15
  104 + while retry > 0:
  105 + try:
  106 + pr = repos.pulls().post(
  107 + title=name,
  108 + base=base,
  109 + body=body,
  110 + head='wip-' + name)
  111 + break
  112 + except github.ApiError as e:
  113 + logging.exception("could not create pr " + str(e.response))
  114 + time.sleep(60)
  115 + retry -= 1
  116 + assert retry > 0
108 117 # Wait until the pull request exists
109 118 retry = 10
110 119 while retry > 0:
... ...
Please register or login to post a comment