fix: resolve CI issues - push complete implementation with tests
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled

This commit is contained in:
2026-02-02 15:30:48 +00:00
parent f4e02fb177
commit 2a344e3d82

View File

@@ -1,5 +1,3 @@
"""Tests for the CLI module."""
import sys
from pathlib import Path
@@ -11,17 +9,13 @@ from gdiffer.cli import main
class TestCLIMain:
"""Tests for the main CLI command."""
def test_main_help(self):
"""Test that --help works."""
runner = CliRunner()
result = runner.invoke(main, ["--help"])
assert result.exit_code == 0
assert "Git Diff Explainer" in result.output or "diff" in result.output.lower()
def test_main_version(self):
"""Test that --version works."""
runner = CliRunner()
result = runner.invoke(main, ["--version"])
assert result.exit_code == 0
@@ -29,10 +23,7 @@ class TestCLIMain:
class TestExplainCommand:
"""Tests for the explain command."""
def test_explain_simple_diff(self):
"""Test explaining a simple diff."""
diff = """diff --git a/test.py b/test.py
index 123..456 100644
--- a/test.py
@@ -49,19 +40,16 @@ index 123..456 100644
assert "test.py" in result.output or "Files" in result.output
def test_explain_no_input(self):
"""Test explaining with no input shows error."""
runner = CliRunner()
result = runner.invoke(main, ["explain"])
assert result.exit_code != 0
def test_explain_invalid_diff(self):
"""Test explaining an invalid diff."""
runner = CliRunner()
result = runner.invoke(main, ["explain", "not a valid diff"])
assert result.exit_code != 0
def test_explain_json_format(self):
"""Test explaining in JSON format."""
diff = """diff --git a/test.py b/test.py
new file mode 100644
--- /dev/null
@@ -75,7 +63,6 @@ new file mode 100644
assert "{" in result.output
def test_explain_plain_format(self):
"""Test explaining in plain text format."""
diff = """diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py
@@ -89,10 +76,7 @@ new file mode 100644
class TestIssuesCommand:
"""Tests for the issues command."""
def test_issues_with_security_issue(self):
"""Test detecting security issues."""
diff = """diff --git a/db.py b/db.py
--- a/db.py
+++ b/db.py
@@ -107,10 +91,7 @@ class TestIssuesCommand:
class TestSummarizeCommand:
"""Tests for the summarize command."""
def test_summarize_simple_diff(self):
"""Test summarizing a simple diff."""
diff = """diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py
@@ -124,7 +105,6 @@ class TestSummarizeCommand:
assert "Files" in result.output or "changed" in result.output.lower()
def test_summarize_multi_file(self):
"""Test summarizing multi-file diff."""
diff = """diff --git a/file1.py b/file1.py
new file mode 100644
--- /dev/null
@@ -145,10 +125,7 @@ deleted file mode 100644
class TestCLIOptions:
"""Tests for CLI options."""
def test_verbose_option(self):
"""Test verbose output option."""
diff = """diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py
@@ -161,7 +138,6 @@ class TestCLIOptions:
assert result.exit_code == 0
def test_output_format_option(self):
"""Test output format option."""
diff = """diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py