From 3cdcba2f2689bbff3f7ba8e6f0c9d581c4686c6b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 16 Nov 2021 13:57:32 +0100 Subject: [PATCH] [FIX] *: better cope with secondary rate limits * the repository apparently takes a lot more time to propagate (randomly) now, so wait until we can *see* it * also add sleep after modification operations on the new repository Ideally this should be done a lot more ubiquitously, but for now this seems to more or less suffice. --- conftest.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/conftest.py b/conftest.py index c0fe27ba..c09fe17b 100644 --- a/conftest.py +++ b/conftest.py @@ -403,6 +403,13 @@ def make_repo(capsys, request, config, tunnel, users): # 'allow_merge_commit': False, 'allow_rebase_merge': False, })) + r = r.json() + # wait for repository visibility + while True: + time.sleep(1) + if github.head(r['url']).ok: + break + repo = Repo(github, fullname, repos) # create webhook @@ -415,6 +422,7 @@ def make_repo(capsys, request, config, tunnel, users): }, 'events': ['pull_request', 'issue_comment', 'status', 'pull_request_review'] })) + time.sleep(1) check(github.put('{}/contents/{}'.format(repo_url, 'a'), json={ 'path': 'a', @@ -422,8 +430,7 @@ def make_repo(capsys, request, config, tunnel, users): 'content': base64.b64encode(b'whee').decode('ascii'), 'branch': 'garbage_%s' % uuid.uuid4() })) - # try to unwatch repo, doesn't actually work - repo.unsubscribe() + time.sleep(1) return repo yield repomaker