mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
- Update quality-gate.yml to only lint hanzo_mcp and tests directories
- Add ruff config to pyproject.toml:
- Exclude vscode-extension and node_modules
- Ignore lint rules that conflict with test patterns:
B023 (loop variable binding), B904 (raise from),
E741 (ambiguous vars), F401/F821/F841 (unused/undefined in tests)
- Apply per-file ignores for tests/ and __init__.py
- Apply ruff fixes for import sorting and format
29 lines
918 B
Python
29 lines
918 B
Python
"""Test utilities specific to memory tests."""
|
|
|
|
from unittest.mock import AsyncMock, Mock, patch
|
|
|
|
from hanzo_mcp.tools.common.context import ToolContext
|
|
|
|
|
|
def create_memory_mock_ctx():
|
|
"""Create a mock context that works with memory tools."""
|
|
mock_ctx = Mock()
|
|
mock_ctx.request_id = "test-request-id"
|
|
mock_ctx.client_id = "test-client-id"
|
|
|
|
# Create a mock that returns a proper tool context
|
|
mock_tool_ctx = Mock(spec=ToolContext)
|
|
mock_tool_ctx.set_tool_info = AsyncMock()
|
|
mock_tool_ctx.info = AsyncMock()
|
|
mock_tool_ctx.debug = AsyncMock()
|
|
mock_tool_ctx.warning = AsyncMock()
|
|
mock_tool_ctx.error = AsyncMock()
|
|
mock_tool_ctx.send_completion_ping = AsyncMock()
|
|
|
|
# Patch create_tool_context to return our mock
|
|
with patch(
|
|
"hanzo_tools.memory.memory_tools.create_tool_context",
|
|
return_value=mock_tool_ctx,
|
|
):
|
|
yield mock_ctx, mock_tool_ctx
|