mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Replace subprocess tests with in-process async servers (#2006)
* Use anyio as testing backend * Remove asyncio markers * Update streamable http tests * Replace all subprocess tests * Replace anyio task groups with asyncio context managers in tests - Convert run_server_async from anyio task group pattern to asyncio.create_task with async context manager - Remove task_group fixture from conftest - Update all test fixtures to use async with run_server_async pattern - Remove TaskGroup imports from all test files - Tests now work with pytest-asyncio instead of pytest-anyio * Update test_github_provider_integration.py
This commit is contained in:
parent
39aebcf578
commit
3321644ad3
28 changed files with 411 additions and 358 deletions
|
|
@ -112,7 +112,6 @@ class TestFastMCPOpenAPIBasicFunctionality:
|
|||
# Should use default name
|
||||
assert server.name == "OpenAPI FastMCP"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_server_creates_tools_from_spec(self, simple_openapi_spec):
|
||||
"""Test that server creates tools from OpenAPI spec."""
|
||||
async with httpx.AsyncClient(base_url="https://api.example.com") as client:
|
||||
|
|
@ -131,7 +130,6 @@ class TestFastMCPOpenAPIBasicFunctionality:
|
|||
assert "get_user" in tool_names
|
||||
assert "create_user" in tool_names
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_server_tool_execution_fallback_to_http(self, simple_openapi_spec):
|
||||
"""Test tool execution falls back to HTTP when callables aren't available."""
|
||||
# Use a mock client that will be used for HTTP fallback
|
||||
|
|
@ -203,7 +201,6 @@ class TestFastMCPOpenAPIBasicFunctionality:
|
|||
assert hasattr(server, "_director")
|
||||
assert hasattr(server, "_spec")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_clean_schema_output_no_unused_defs(self):
|
||||
"""Test that unused schema definitions are removed from tool schemas."""
|
||||
# Create a spec with unused HTTPValidationError-like definitions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue