Coverage for tests/conftest.py: 100.00%
15 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-02 00:26 +0200
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-02 00:26 +0200
1"""Configuration for the pytest test suite."""
3from __future__ import annotations
5from typing import TYPE_CHECKING
7import pytest
9from git_changelog.commit import AngularConvention
10from tests.helpers import GitRepo
12if TYPE_CHECKING:
13 from pathlib import Path
16@pytest.fixture(name="repo")
17def git_repo(tmp_path: Path, request: pytest.FixtureRequest) -> GitRepo:
18 """Pytest fixture setting up a temporary Git repository.
20 Parameters:
21 tmp_path: Path to a temporary directory (pytest fixture).
23 Yields:
24 A Git repository wrapper instance.
25 """
26 repo = GitRepo(tmp_path)
27 versions = getattr(request, "param", [])
28 for version in versions:
29 for section in AngularConvention.TYPES:
30 repo.commit(f"{section}: Summary.")
31 if version:
32 repo.git("tag", version)
33 return repo