Builds a single-turn agent runner whose only tool source is ``toolset``. Single-turn (one ``Part.from_text`` response) so the assertion on ``list_tools_call_count`` is unambiguous: exactly one agent invocation is performed.
(toolset: McpToolset)
| 528 | |
| 529 | |
| 530 | def _build_mcp_test_runner(toolset: McpToolset) -> TestInMemoryRunner: |
| 531 | """Builds a single-turn agent runner whose only tool source is ``toolset``. |
| 532 | |
| 533 | Single-turn (one ``Part.from_text`` response) so the assertion on |
| 534 | ``list_tools_call_count`` is unambiguous: exactly one agent invocation |
| 535 | is performed. |
| 536 | """ |
| 537 | mock_model = MockModel.create( |
| 538 | responses=[Part.from_text(text="text response")] |
| 539 | ) |
| 540 | test_agent = Agent( |
| 541 | name="some_root_agent", |
| 542 | description="A sample root agent.", |
| 543 | instruction="you are helpful", |
| 544 | model=mock_model, |
| 545 | tools=[toolset], |
| 546 | ) |
| 547 | return TestInMemoryRunner(node=test_agent) |
| 548 | |
| 549 | |
| 550 | @pytest.mark.asyncio |
no test coverage detected