Close unclosed resources in the whole project (#267)
* Close resources * Close all resources * Update pyproject.toml * Close all resources * Close all resources * try now... * try to ignore this * try again * try adding one more.. * try now * try now * revert ci changes
This commit is contained in:
parent
1691b905e2
commit
94d326dbf1
1 changed files with 64 additions and 11 deletions
|
|
@ -25,7 +25,7 @@ async def test_lowlevel_server_lifespan():
|
|||
"""Test that lifespan works in low-level server."""
|
||||
|
||||
@asynccontextmanager
|
||||
async def test_lifespan(server: Server) -> AsyncIterator[dict]:
|
||||
async def test_lifespan(server: Server) -> AsyncIterator[dict[str, bool]]:
|
||||
"""Test lifespan context that tracks startup/shutdown."""
|
||||
context = {"started": False, "shutdown": False}
|
||||
try:
|
||||
|
|
@ -50,7 +50,13 @@ async def test_lowlevel_server_lifespan():
|
|||
return [{"type": "text", "text": "true"}]
|
||||
|
||||
# Run server in background task
|
||||
async with anyio.create_task_group() as tg:
|
||||
async with (
|
||||
anyio.create_task_group() as tg,
|
||||
send_stream1,
|
||||
receive_stream1,
|
||||
send_stream2,
|
||||
receive_stream2,
|
||||
):
|
||||
|
||||
async def run_server():
|
||||
await server.run(
|
||||
|
|
@ -147,7 +153,13 @@ async def test_fastmcp_server_lifespan():
|
|||
return True
|
||||
|
||||
# Run server in background task
|
||||
async with anyio.create_task_group() as tg:
|
||||
async with (
|
||||
anyio.create_task_group() as tg,
|
||||
send_stream1,
|
||||
receive_stream1,
|
||||
send_stream2,
|
||||
receive_stream2,
|
||||
):
|
||||
|
||||
async def run_server():
|
||||
await server._mcp_server.run(
|
||||
|
|
|
|||
Loading…
Reference in a new issue