Add test files (unit and integration tests)
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-02-02 10:11:04 +00:00
parent f052a36689
commit 6c2c810495

View File

@@ -1,12 +1,11 @@
"""Unit tests for CLI commands."""
from unittest.mock import MagicMock, patch
import pytest
from click.testing import CliRunner
from unittest.mock import patch, MagicMock
import sys
from io import StringIO
from loglens.cli.commands import analyze, watch, report, patterns, info
from loglens.cli.commands import analyze, info, patterns, report, watch
@pytest.fixture
@@ -18,7 +17,7 @@ def runner():
class TestAnalyzeCommand:
"""Tests for analyze command."""
@patch('loglens.cli.commands.LogAnalyzer')
@patch("loglens.cli.commands.LogAnalyzer")
def test_analyze_file(self, mock_analyzer_class, runner, tmp_path):
"""Test analyzing a log file."""
mock_analyzer = MagicMock()
@@ -43,7 +42,7 @@ class TestAnalyzeCommand:
assert result.exit_code == 0
@patch('loglens.cli.commands.LogAnalyzer')
@patch("loglens.cli.commands.LogAnalyzer")
def test_analyze_json_output(self, mock_analyzer_class, runner, tmp_path):
"""Test analyze with JSON output."""
mock_analyzer = MagicMock()
@@ -90,7 +89,7 @@ class TestWatchCommand:
class TestReportCommand:
"""Tests for report command."""
@patch('loglens.cli.commands.LogAnalyzer')
@patch("loglens.cli.commands.LogAnalyzer")
def test_report_to_file(self, mock_analyzer_class, runner, tmp_path):
"""Test report generation to file."""
mock_analyzer = MagicMock()
@@ -118,7 +117,7 @@ class TestReportCommand:
class TestPatternsCommand:
"""Tests for patterns command."""
@patch('loglens.cli.commands.LogAnalyzer')
@patch("loglens.cli.commands.LogAnalyzer")
def test_list_patterns(self, mock_analyzer_class, runner):
"""Test listing patterns."""
mock_analyzer = MagicMock()