Skip to content

Commit 09cdc83

Browse files
committed
Fix tests
1 parent f88dc59 commit 09cdc83

File tree

5 files changed

+8
-42
lines changed

5 files changed

+8
-42
lines changed

pydantic_ai_slim/pydantic_ai/toolsets/abstract.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,3 @@ def renamed(self, name_map: dict[str, str]) -> RenamedToolset[AgentDepsT]:
149149
from .renamed import RenamedToolset
150150

151151
return RenamedToolset(self, name_map)
152-
153-

pydantic_ai_slim/pydantic_ai/toolsets/combined.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ async def call_tool(
7171

7272
def apply(self, visitor: Callable[[AbstractToolset[AgentDepsT]], None]) -> None:
7373
for toolset in self.toolsets:
74-
toolset.apply(visitor)
74+
toolset.apply(visitor)

pydantic_ai_slim/pydantic_ai/toolsets/dynamic.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/test_mcp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ async def test_context_manager_initialization_error() -> None:
9696
server = MCPServerStdio('python', ['-m', 'tests.mcp_server'])
9797
from mcp.client.session import ClientSession
9898

99+
with pytest.raises(Exception):
100+
_ = server.client
101+
99102
with patch.object(ClientSession, 'initialize', side_effect=Exception):
100103
with pytest.raises(Exception):
101104
async with server.setup():

tests/test_toolsets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
from collections.abc import AsyncGenerator
66
from contextlib import asynccontextmanager
77
from dataclasses import dataclass, replace
8-
from typing import Any, Self, TypeVar
8+
from typing import Any, TypeVar
99

1010
import pytest
1111
from inline_snapshot import snapshot
12+
from typing_extensions import Self
1213

1314
from pydantic_ai._run_context import RunContext
1415
from pydantic_ai._tool_manager import ToolManager
@@ -491,15 +492,14 @@ class FailingToolset(AbstractToolset[Any]):
491492
async def setup(self) -> AsyncGenerator[Self, Any]:
492493
raise InitializationError
493494

494-
yield self
495+
yield self # pragma: no cover
495496

496497
async def get_tools(self, ctx: RunContext[Any]) -> dict[str, ToolsetTool[Any]]:
497498
return {}
498499

499500
async def call_tool(
500501
self, name: str, tool_args: dict[str, Any], ctx: RunContext[Any], tool: ToolsetTool[Any]
501-
) -> Any:
502-
return None
502+
) -> Any: ...
503503

504504
server1 = MCPServerStdio('python', ['-m', 'tests.mcp_server'])
505505
server2 = FailingToolset()

0 commit comments

Comments
 (0)