Skip to content

Commit

Permalink
fix: added testing timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianKuesters committed Apr 19, 2024
1 parent 5dbbb96 commit a270486
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/e2e/test_utils/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down Expand Up @@ -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()
Expand All @@ -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')
Expand Down

0 comments on commit a270486

Please sign in to comment.