MCPcopy Index your code
hub / github.com/google/adk-python / _make_test_runner

Function _make_test_runner

tests/unittests/telemetry/test_telemetry_context.py:568–581  ·  view source on GitHub ↗

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',
)

Source from the content-addressed store, hash-verified

566
567
568def _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

Calls 2

InMemoryRunnerClass · 0.50
createMethod · 0.45

Tested by

no test coverage detected