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

Function test_close_with_timeout

tests/unittests/plugins/test_plugin_manager.py:304–319  ·  view source on GitHub ↗

Tests that close respects the timeout and raises on failure.

(plugin1: TestPlugin)

Source from the content-addressed store, hash-verified

302
303@pytest.mark.asyncio
304async def test_close_with_timeout(plugin1: TestPlugin):
305 """Tests that close respects the timeout and raises on failure."""
306 service = PluginManager(close_timeout=0.1)
307
308 async def slow_close():
309 await asyncio.sleep(0.2)
310
311 plugin1.close = slow_close
312 service.register_plugin(plugin1)
313
314 with pytest.raises(RuntimeError) as excinfo:
315 await service.close()
316
317 assert "Failed to close plugins: 'plugin1': TimeoutError" in str(
318 excinfo.value
319 )
320
321
322@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

register_pluginMethod · 0.95
closeMethod · 0.95
PluginManagerClass · 0.90

Tested by

no test coverage detected