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

Class TestInMemoryRunner

tests/unittests/workflow/testing_utils.py:213–242  ·  view source on GitHub ↗

InMemoryRunner that is tailored for tests, features async run method. app_name is hardcoded as InMemoryRunner in the parent class.

Source from the content-addressed store, hash-verified

211
212
213class TestInMemoryRunner(AfInMemoryRunner):
214 """InMemoryRunner that is tailored for tests, features async run method.
215
216 app_name is hardcoded as InMemoryRunner in the parent class.
217 """
218
219 async def run_async_with_new_session(
220 self, new_message: types.ContentUnion
221 ) -> list[Event]:
222
223 collected_events: list[Event] = []
224 async for event in self.run_async_with_new_session_agen(new_message):
225 collected_events.append(event)
226
227 return collected_events
228
229 async def run_async_with_new_session_agen(
230 self, new_message: types.ContentUnion
231 ) -> AsyncGenerator[Event, None]:
232 session = await self.session_service.create_session(
233 app_name='InMemoryRunner', user_id='test_user'
234 )
235 agen = self.run_async(
236 user_id=session.user_id,
237 session_id=session.id,
238 new_message=get_user_content(new_message),
239 )
240 async with Aclosing(agen):
241 async for event in agen:
242 yield event
243
244
245class InMemoryRunner:

Callers 2

_build_mcp_test_runnerFunction · 0.50
build_test_runnerFunction · 0.50

Calls

no outgoing calls

Tested by 2

_build_mcp_test_runnerFunction · 0.40
build_test_runnerFunction · 0.40