-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_mcp_tools.py
More file actions
90 lines (69 loc) · 3.09 KB
/
test_mcp_tools.py
File metadata and controls
90 lines (69 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
"""
Test Mcp Tools Tests
This file contains tests migrated from test_mcp_comprehensive.py.
"""
import pytest
pytestmark = pytest.mark.mcp
import sys
from pathlib import Path
from typing import Any
# Add src to path for imports
sys.path.insert(0, str(Path(__file__).parent.parent))
# Migrated from test_mcp_integration_comprehensive.py
class TestMCPToolExecution:
"""Test actual MCP tool execution."""
@pytest.mark.unit
@pytest.mark.safe_to_fail
def test_gnn_validate_tool_execution(self, test_mcp_tools: Any, comprehensive_test_data: Any) -> None:
"""Test GNN validation tool registration (lightweight test)."""
try:
from gnn.mcp import register_tools
register_tools(test_mcp_tools)
# Just verify that the tool was registered properly
assert 'validate_gnn_content' in test_mcp_tools.tools
tool_info = test_mcp_tools.tools['validate_gnn_content']
assert 'function' in tool_info
assert 'description' in tool_info
assert callable(tool_info['function'])
except ImportError:
pytest.skip("GNN MCP not available")
except Exception as e:
# Should handle registration errors gracefully
assert "error" in str(e).lower() or "import" in str(e).lower()
@pytest.mark.unit
@pytest.mark.safe_to_fail
def test_export_tool_execution(self, test_mcp_tools: Any, comprehensive_test_data: Any) -> None:
"""Test export tool registration (lightweight test)."""
try:
from export.mcp import register_tools
register_tools(test_mcp_tools)
# Just verify that tools were registered properly
assert len(test_mcp_tools.tools) > 0
for _tool_name, tool_info in test_mcp_tools.tools.items():
assert 'function' in tool_info
assert 'description' in tool_info
assert callable(tool_info['function'])
except ImportError:
pytest.skip("Export MCP not available")
except Exception as e:
# Should handle registration errors gracefully
assert "error" in str(e).lower() or "import" in str(e).lower()
@pytest.mark.unit
@pytest.mark.safe_to_fail
def test_utils_system_info_execution(self, test_mcp_tools: Any) -> None:
"""Test utils system info tool registration (lightweight test)."""
try:
from utils.mcp import register_tools
register_tools(test_mcp_tools)
# Just verify that the system info tool was registered properly
assert 'get_system_info' in test_mcp_tools.tools
tool_info = test_mcp_tools.tools['get_system_info']
assert 'function' in tool_info
assert 'description' in tool_info
assert callable(tool_info['function'])
except ImportError:
pytest.skip("Utils MCP not available")
except Exception as e:
# Should handle registration errors gracefully
assert "error" in str(e).lower() or "import" in str(e).lower()