Files
git-commit-ai/git_commit_ai/tests/test_git_handler.py
7000pctAUTO 71b203a188
Some checks failed
CI / test (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
fix: resolve CI build failures
2026-01-31 04:00:23 +00:00

22 lines
741 B
Python

import pytest
import subprocess
import os
import tempfile
from git_commit_ai.core.git_handler import get_staged_changes, get_commit_history
def test_get_commit_history_empty():
"""Test get commit history when no commits exist."""
with tempfile.TemporaryDirectory() as tmpdir:
os.chdir(tmpdir)
subprocess.run(['git', 'init'], capture_output=True)
history = get_commit_history()
assert history == []
def test_get_staged_changes_empty_repo():
"""Test get staged changes in empty repository."""
with tempfile.TemporaryDirectory() as tmpdir:
os.chdir(tmpdir)
subprocess.run(['git', 'init'], capture_output=True)
changes = get_staged_changes()
assert changes == []