From f06765c86d0302d8d18bb271105e946daf3b255f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 07:56:52 +0000 Subject: [PATCH] Fix lint and type-checker issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add ClassVar import to tests for proper type annotations - Add type ignore comment for crewai_tools import to suppress mypy error - Fix line length violations by breaking long assert statements - Add ClassVar annotations for mutable class attributes in test classes Co-Authored-By: João --- src/crewai/project/crew_base.py | 2 +- tests/test_project.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/crewai/project/crew_base.py b/src/crewai/project/crew_base.py index 6bd035279..87b1142fd 100644 --- a/src/crewai/project/crew_base.py +++ b/src/crewai/project/crew_base.py @@ -90,7 +90,7 @@ def CrewBase(cls: T) -> T: if not self.mcp_server_params: return [] - from crewai_tools import MCPServerAdapter + from crewai_tools import MCPServerAdapter # type: ignore[import-untyped] adapter = getattr(self, '_mcp_server_adapter', None) if not adapter: diff --git a/tests/test_project.py b/tests/test_project.py index 97057c3e1..3a99f2790 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -1,4 +1,5 @@ from typing import List +from typing import ClassVar from unittest.mock import Mock, patch import pytest @@ -284,7 +285,9 @@ def test_internal_crew_with_mcp(): assert crew.reporting_analyst().tools == [simple_tool, another_simple_tool] assert crew.researcher().tools == [simple_tool] - adapter_mock.assert_called_once_with({"host": "localhost", "port": 8000}, connect_timeout=30) + adapter_mock.assert_called_once_with( + {"host": "localhost", "port": 8000}, connect_timeout=30 + ) def test_internal_crew_with_mcp_custom_timeout(): with patch("embedchain.client.Client.setup"): @@ -293,7 +296,7 @@ def test_internal_crew_with_mcp_custom_timeout(): @CrewBase class CrewWithCustomTimeout(InternalCrew): - mcp_server_params = {"host": "localhost", "port": 8000} + mcp_server_params: ClassVar = {"host": "localhost", "port": 8000} @agent def test_agent(self): @@ -308,7 +311,9 @@ def test_internal_crew_with_mcp_custom_timeout(): crew = CrewWithCustomTimeout() assert crew.test_agent().tools == [simple_tool] - adapter_mock.assert_called_once_with({"host": "localhost", "port": 8000}, connect_timeout=60) + adapter_mock.assert_called_once_with( + {"host": "localhost", "port": 8000}, connect_timeout=60 + ) def test_internal_crew_with_mcp_backward_compatibility(): @@ -318,7 +323,7 @@ def test_internal_crew_with_mcp_backward_compatibility(): @CrewBase class CrewWithoutTimeout(InternalCrew): - mcp_server_params = {"host": "localhost", "port": 8000} + mcp_server_params: ClassVar = {"host": "localhost", "port": 8000} @agent def test_agent(self): @@ -333,4 +338,6 @@ def test_internal_crew_with_mcp_backward_compatibility(): crew = CrewWithoutTimeout() assert crew.test_agent().tools == [simple_tool] - adapter_mock.assert_called_once_with({"host": "localhost", "port": 8000}, connect_timeout=30) + adapter_mock.assert_called_once_with( + {"host": "localhost", "port": 8000}, connect_timeout=30 + )