Tests that close respects the timeout and raises on failure.
(plugin1: TestPlugin)
| 302 | |
| 303 | @pytest.mark.asyncio |
| 304 | async 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 |
nothing calls this directly
no test coverage detected