Skip to content

Commit 64b436e

Browse files
Fix mypy type errors in test_agent_mcp_server.py
Declare variables with Any type before try-import block to satisfy mypy type checking when the imports may fail. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent 46e892b commit 64b436e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

test/services/test_agent_mcp_server.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
14+
from typing import Any, Optional
1415
from unittest.mock import AsyncMock, Mock, patch
1516

1617
import pytest
@@ -20,6 +21,18 @@
2021
from camel.responses import ChatAgentResponse
2122
from camel.toolkits import FunctionTool
2223

24+
# Declare variables with Optional types to satisfy mypy
25+
agents_dict: Any = None
26+
description_dict: Any = None
27+
get_agent_info: Any = None
28+
get_agents_info: Any = None
29+
get_available_tools: Any = None
30+
get_chat_history: Any = None
31+
reset: Any = None
32+
set_output_language: Any = None
33+
step: Any = None
34+
_IMPORT_ERROR: Optional[str] = None
35+
2336
# Try to import agent_config, skip tests if API keys are missing
2437
try:
2538
from services.agent_mcp.agent_config import agents_dict, description_dict
@@ -32,18 +45,7 @@
3245
set_output_language,
3346
step,
3447
)
35-
36-
_IMPORT_ERROR = None
3748
except ValueError as e:
38-
agents_dict = None
39-
description_dict = None
40-
get_agent_info = None
41-
get_agents_info = None
42-
get_available_tools = None
43-
get_chat_history = None
44-
reset = None
45-
set_output_language = None
46-
step = None
4749
_IMPORT_ERROR = str(e)
4850

4951
# Skip all tests if imports failed due to missing API keys

0 commit comments

Comments
 (0)