feat: add pytest testing infrastructure
- Add test optional dependencies to pyproject.toml - Add conftest.py with fixtures for mocking settings and MCP client - Add test_server.py with tests for tryton_call and MCP tools
This commit is contained in:
25
tests/conftest.py
Normal file
25
tests/conftest.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from unittest.mock import MagicMock, patch
|
||||
from fastmcp import Client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_settings():
|
||||
with patch("tryton_mcp.server.settings") as mock:
|
||||
mock_client = MagicMock()
|
||||
mock.get_client.return_value = mock_client
|
||||
yield mock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mcp_server():
|
||||
from tryton_mcp.server import mcp
|
||||
|
||||
return mcp
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def mcp_client(mcp_server):
|
||||
async with Client(mcp_server) as client:
|
||||
yield client
|
||||
Reference in New Issue
Block a user