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:
2026-03-09 16:04:34 -05:00
parent 45e73b6856
commit c670ea5bc9
4 changed files with 233 additions and 1 deletions

25
tests/conftest.py Normal file
View 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