diff --git a/rhodecode/tests/vcs_operations/test_vcs_operations_branch_protection.py b/rhodecode/tests/vcs_operations/test_vcs_operations_branch_protection.py index 49ed26b9..35ecf829 100644 --- a/rhodecode/tests/vcs_operations/test_vcs_operations_branch_protection.py +++ b/rhodecode/tests/vcs_operations/test_vcs_operations_branch_protection.py @@ -17,6 +17,8 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import os +import time + import pytest from rhodecode.tests import TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS, TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS @@ -54,6 +56,12 @@ class TestVCSOperations(object): branch_permission_setter(repo_name, username, permission=branch_perm) clone_url = rcstack.repo_clone_url(repo.repo_name, user=username, passwd=password) + # Give VCSServer time to initialize the empty Mercurial repository + # Empty hg repos (unlike git bare repos) need a moment to be fully indexed + # This prevents intermittent "repository is unrelated" errors + time.sleep(0.2) + repo.scm_instance(cache=False) # Force load in VCSServer + Command(os.path.dirname(tmpdir.strpath)).execute("hg clone", clone_url, tmpdir.strpath) stdout, stderr = _add_files_and_push("hg", tmpdir.strpath, clone_url=clone_url)