Files
git-ai-doc-generator/tests/conftest.py
7000pctAUTO 218f7a6e99
Some checks failed
CI / test (push) Has been cancelled
Initial upload: Git AI Documentation Generator v0.1.0
2026-02-01 19:31:08 +00:00

68 lines
1.6 KiB
Python

"""Test configuration and fixtures."""
import os
import tempfile
from pathlib import Path
import pytest
os.chdir("/app")
@pytest.fixture
def temp_git_repo():
"""Create a temporary git repository for testing."""
with tempfile.TemporaryDirectory() as tmpdir:
os.chdir(tmpdir)
os.system("git init --quiet")
os.system("git config user.email 'test@example.com'")
os.system("git config user.name 'Test User'")
yield Path(tmpdir)
os.chdir("/app")
@pytest.fixture
def sample_diff():
"""Sample git diff for testing."""
return """diff --git a/src/main.py b/src/main.py
index 1234567..89abcdef 100644
--- a/src/main.py
+++ b/src/main.py
@@ -1,3 +1,5 @@
+def hello():
+ print("Hello, World!")
def main():
print("Hello")
"""
@pytest.fixture
def sample_commits():
"""Sample commit history for testing."""
return [
{
"sha": "abc1234",
"message": "feat(auth): add user authentication",
"author": "John Doe",
"date": "2024-01-15T10:30:00",
"type": "feat",
"scope": "auth",
},
{
"sha": "def5678",
"message": "fix(api): resolve endpoint timeout",
"author": "Jane Smith",
"date": "2024-01-14T15:45:00",
"type": "fix",
"scope": "api",
},
{
"sha": "ghi9012",
"message": "docs: update README",
"author": "Bob Wilson",
"date": "2024-01-13T09:00:00",
"type": "docs",
"scope": None,
},
]