From 9c6380c4805029599acf1221739b4a6d6304af44 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 1 Feb 2023 14:23:03 +0100 Subject: [PATCH] [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). --- conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conftest.py b/conftest.py index 95fa6be4..72e5ba71 100644 --- a/conftest.py +++ b/conftest.py @@ -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):