[FIX] conftest: there can be some delay on repo content initialization

Seems to be a new github weirdness: when forking a repo, when hitting
it fast enough it's apparently possible to see the repository in an
incomplete state (without its content).

Obviously this causes tests to fail.

Complete the post-fork testing by listing the branches of the fork,
and considering the repo created once we see a non-empty list (the
source repo should always have at least one branch, which should be
copied over when forking).
This commit is contained in:
Xavier Morel 2023-02-01 14:23:03 +01:00
parent f7a12c6359
commit 9c6380c480

View File

@ -732,6 +732,12 @@ class Repo:
raise TimeoutError("No response for repo %s over 60s" % repo_name)
time.sleep(1)
# wait for the branches (which should have been copied over) to be visible
while not s.get(f'{repo_url}/branches').json():
if time.time() > limit:
raise TimeoutError("No response for repo %s over 60s" % repo_name)
time.sleep(1)
return Repo(s, repo_name, self._repos)
def get_pr(self, number):