Address all review comments: fix test counts, remove unused imports, improve workflow

Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-03 10:59:56 +00:00
parent 0411d0856a
commit 6bb006fbe1
4 changed files with 29 additions and 32 deletions

View file

@ -105,30 +105,25 @@ tests/
## Test Statistics
- **Total Tests**: 173 (+57 from initial 116)
- **Total Tests**: 173 tests (up from 116)
- **Passing**: 173 (100%)
- **Code Coverage**: 100% (up from 97%)
- **Test Execution Time**: ~1.1 seconds
## Test Breakdown
- **Unit Tests**: 156 tests
- MentionDetector: 73 tests (including 45 parameterized)
- **Unit Tests**: 163 tests
- MentionDetector: 84 tests (including 45 parameterized)
- Logger: 16 tests
- ConversationMemory: 28 tests
- PerplexityProvider: 22 tests
- Config: 27 tests
- Config: 29 tests
- **Integration Tests**: 9 tests
- **Integration Tests**: 10 tests
- Full workflow testing
- Component interaction
- Error recovery scenarios
- **Parameterized Tests**: 45 tests
- Mention detection patterns
- Greeting detection
- Content extraction
## Improvements from Initial Version
**100% code coverage** (was 97%)

View file

@ -3,8 +3,7 @@ Integration tests for Eugen Bot
Tests the full workflow and component integration
"""
import pytest
import asyncio
from unittest.mock import Mock, AsyncMock, patch, MagicMock
from unittest.mock import Mock, AsyncMock, patch
from config import Config
from memory import ConversationMemory
from ai_provider import PerplexityProvider
@ -71,7 +70,6 @@ class TestFullWorkflow:
"""Test that conversation context is preserved across messages"""
config = Config(env_file=str(mock_env_file), config_file=str(temp_dir / "config.json"))
memory = ConversationMemory(data_dir=str(temp_dir / "conversations"))
ai = PerplexityProvider(api_key=config.perplexity_key)
username = "testuser"
@ -175,7 +173,6 @@ class TestFullWorkflow:
@pytest.mark.asyncio
async def test_memory_limit_enforcement_in_workflow(self, temp_dir, mock_env_file):
"""Test that memory limits are enforced during conversation"""
config = Config(env_file=str(mock_env_file), config_file=str(temp_dir / "config.json"))
memory = ConversationMemory(
data_dir=str(temp_dir / "conversations"),
max_messages=10
@ -266,11 +263,12 @@ class TestComponentInteraction:
# Create complete config
complete_env = temp_dir / "complete.env"
complete_env.write_text("""TWITCH_OAUTH_TOKEN=oauth:test123
TWITCH_CHANNEL=#testchannel
TWITCH_BOT_NICKNAME=TestBot
PERPLEXITY_API_KEY=pplx-test123
""")
complete_env.write_text(
"TWITCH_OAUTH_TOKEN=oauth:test123\n"
"TWITCH_CHANNEL=#testchannel\n"
"TWITCH_BOT_NICKNAME=TestBot\n"
"PERPLEXITY_API_KEY=pplx-test123\n"
)
config2 = Config(env_file=str(complete_env), config_file=str(temp_dir / "config.json"))

View file

@ -2,7 +2,6 @@
Tests for utility classes: MentionDetector and Logger
"""
import pytest
from pathlib import Path
import logging
from utils import MentionDetector, Logger
@ -20,7 +19,7 @@ MENTION_TEST_CASES = [
("Eugen. listen", "Eugen", True, "period format"),
("Hey Eugen how are you", "Eugen", True, "mention in middle"),
("Is Eugen online?", "Eugen", True, "mention as word"),
("Eugene is different", "Eugen", False, "partial match should fail"),
("Eugene is different", "Eugen", False, "name as substring of longer word should fail"),
("Eugenics is a topic", "Eugen", False, "false positive check"),
("Regular message", "Eugen", False, "no mention"),
("@kenearosmd hi", "kenearosmd", True, "long name at-mention"),
@ -436,18 +435,18 @@ class TestLogger:
def test_logger_reuses_existing_handlers(self, temp_dir):
"""Test that logger doesn't create duplicate handlers"""
import logging
log_dir = temp_dir / "logs"
# Create first logger
logger1 = Logger(log_dir=str(log_dir), debug_mode=True)
handler_count_1 = len(logger1.main_logger.handlers)
# Create first logger instance to set up handlers
Logger(log_dir=str(log_dir), debug_mode=True)
main_logger_1 = logging.getLogger("eugen_main")
handler_count_1 = len(main_logger_1.handlers)
# Create second logger with same settings - should reuse handlers
logger2 = Logger(log_dir=str(log_dir), debug_mode=True)
handler_count_2 = len(logger2.main_logger.handlers)
# Create second logger with same settings - should not add handlers
Logger(log_dir=str(log_dir), debug_mode=True)
main_logger_2 = logging.getLogger("eugen_main")
handler_count_2 = len(main_logger_2.handlers)
# Should have same number of handlers (reused, not duplicated)
# Underlying logger should have the same number of handlers (reused, not duplicated)
assert handler_count_1 == handler_count_2
assert handler_count_1 > 0 # But should have at least one handler