Fixed MagicMock comparison errors across multiple test suites by: - Adding proper ModelCapabilities mocks with real values instead of MagicMock objects - Updating test_auto_mode.py with correct provider mocking for model availability tests - Updating test_thinking_modes.py with proper capabilities mocking in all thinking mode tests - Updating test_tools.py with proper capabilities mocking for CodeReview and Analyze tools - Fixing test_large_prompt_handling.py by adding proper provider mocking to prevent errors before large prompt detection Fixed pytest collection warnings by: - Renaming TestGenRequest to TestGenerationRequest to avoid pytest collecting it as a test class - Renaming TestGenTool to TestGenerationTool to avoid pytest collecting it as a test class - Updated all imports and references across server.py, tools/__init__.py, and test files All 459 tests now pass without warnings or MagicMock comparison errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""
|
|
Integration test demonstrating that all tools get line numbers by default.
|
|
"""
|
|
|
|
from tools.analyze import AnalyzeTool
|
|
from tools.chat import ChatTool
|
|
from tools.codereview import CodeReviewTool
|
|
from tools.debug import DebugIssueTool
|
|
from tools.precommit import Precommit
|
|
from tools.refactor import RefactorTool
|
|
from tools.testgen import TestGenerationTool
|
|
|
|
|
|
class TestLineNumbersIntegration:
|
|
"""Test that all tools inherit line number behavior correctly."""
|
|
|
|
def test_all_tools_want_line_numbers(self):
|
|
"""Verify that all tools want line numbers by default."""
|
|
tools = [
|
|
ChatTool(),
|
|
AnalyzeTool(),
|
|
CodeReviewTool(),
|
|
DebugIssueTool(),
|
|
RefactorTool(),
|
|
TestGenerationTool(),
|
|
Precommit(),
|
|
]
|
|
|
|
for tool in tools:
|
|
assert tool.wants_line_numbers_by_default(), f"{tool.get_name()} should want line numbers by default"
|
|
|
|
def test_no_tools_override_line_numbers(self):
|
|
"""Verify that no tools override the base class line number behavior."""
|
|
# Check that tools don't have their own wants_line_numbers_by_default method
|
|
tools_classes = [
|
|
ChatTool,
|
|
AnalyzeTool,
|
|
CodeReviewTool,
|
|
DebugIssueTool,
|
|
RefactorTool,
|
|
TestGenerationTool,
|
|
Precommit,
|
|
]
|
|
|
|
for tool_class in tools_classes:
|
|
# Check if the method is defined in the tool class itself
|
|
# (not inherited from base)
|
|
has_override = "wants_line_numbers_by_default" in tool_class.__dict__
|
|
assert not has_override, f"{tool_class.__name__} should not override wants_line_numbers_by_default"
|