Files
python-mcp-toolbox/tests/conftest.py
2026-03-16 14:12:06 +01:00

34 lines
756 B
Python

"""Shared pytest fixtures."""
import sys
from pathlib import Path
import pytest
import pytest_asyncio
from mcp_api import MCPToolbox
FIXTURES = Path(__file__).parent / "fixtures"
@pytest.fixture
def server_config() -> dict:
"""Config dict for the two test MCP servers, using the current Python interpreter."""
python = sys.executable
return {
"echo": {
"command": python,
"args": [str(FIXTURES / "echo_server.py")],
},
"math": {
"command": python,
"args": [str(FIXTURES / "math_server.py")],
},
}
@pytest_asyncio.fixture
async def toolbox(server_config: dict) -> MCPToolbox:
async with MCPToolbox.from_config(server_config) as tb:
yield tb