Fix all failing tests and pytest collection warnings
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>
This commit is contained in:
@@ -160,6 +160,7 @@ class TestAutoMode:
|
||||
patch("providers.registry.ModelProviderRegistry.get_provider_for_model") as mock_provider,
|
||||
patch("providers.registry.ModelProviderRegistry.get_available_models") as mock_available,
|
||||
patch.object(tool, "_get_available_models") as mock_tool_available,
|
||||
patch("providers.registry.ModelProviderRegistry.is_model_available") as mock_is_available,
|
||||
):
|
||||
|
||||
# Mock that o3 is not available but actual available models are
|
||||
@@ -198,6 +199,12 @@ class TestAutoMode:
|
||||
# Mock the tool's available models method to return the actual available models
|
||||
mock_tool_available.return_value = available_models
|
||||
|
||||
# Mock is_model_available to return False for o3 specifically
|
||||
def mock_model_available(model_name):
|
||||
return model_name != "o3" and model_name in available_models
|
||||
|
||||
mock_is_available.side_effect = mock_model_available
|
||||
|
||||
# Execute with unavailable model
|
||||
result = await tool.execute(
|
||||
{"files": ["/tmp/test.py"], "prompt": "Analyze this", "model": "o3"} # This model is not available
|
||||
|
||||
Reference in New Issue
Block a user