Builds an InMemoryRunner with a deterministic MockModel. Each invocation drives one ``generate_content`` call returning a short text response, which is enough to exercise the ``use_inference_span`` + ``trace_inference_result`` code path that consumes ``RunConfig.telemetry``.
(
agent_name: str = 'telemetry_test_agent',
)
| 566 | |
| 567 | |
| 568 | def _make_test_runner( |
| 569 | agent_name: str = 'telemetry_test_agent', |
| 570 | ) -> InMemoryRunner: |
| 571 | """Builds an InMemoryRunner with a deterministic MockModel. |
| 572 | |
| 573 | Each invocation drives one ``generate_content`` call returning a short |
| 574 | text response, which is enough to exercise the ``use_inference_span`` + |
| 575 | ``trace_inference_result`` code path that consumes ``RunConfig.telemetry``. |
| 576 | """ |
| 577 | mock_model = MockModel.create( |
| 578 | responses=[Part.from_text(text='ok')], |
| 579 | ) |
| 580 | agent = Agent(name=agent_name, model=mock_model) |
| 581 | return InMemoryRunner(root_agent=agent) |
| 582 | |
| 583 | |
| 584 | @pytest.fixture |
no test coverage detected