From a27048687b848d0c96943429f694697320d8f553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCsters?= Date: Fri, 19 Apr 2024 14:30:32 +0200 Subject: [PATCH] fix: added testing timeout --- tests/e2e/test_utils/test_repo.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/e2e/test_utils/test_repo.py b/tests/e2e/test_utils/test_repo.py index 14175c3..b99b0fe 100644 --- a/tests/e2e/test_utils/test_repo.py +++ b/tests/e2e/test_utils/test_repo.py @@ -8,11 +8,17 @@ from tempfile import TemporaryDirectory from typing import Any from uuid import uuid4 +from time import sleep from get_release_version_action.utils.git import tag_creation_history from git import Commit, Repo +TESTING_TIMEOUT = 1 +""" +Timeout in seconds for waiting for git operations to ensure that we don't have multiple operations for the same second. +""" + logger = logging.getLogger('wemogy.get-release-version-action.tests.repo') __all__ = [ @@ -104,6 +110,7 @@ def checkout(self, branch_name: str) -> None: :raises GitBranchNotFoundError: If the branch was not found. """ logger.info('Checking out branch %s', branch_name) + sleep(TESTING_TIMEOUT) try: self.repo.heads[branch_name].checkout() @@ -118,6 +125,7 @@ def commit(self, message: CommitMessages | str, file_name: str | None = None) -> :param file_name: An optional file name. Defaults to ``file_{uuid4()}``. :returns: The created commit. """ + sleep(TESTING_TIMEOUT) file_name = file_name or f'file_{uuid4()}' file_path = self.path / file_name file_path.write_text('test', encoding='utf-8')