Add shutdown() plugin hook with ordered graceful teardown (#2890)

This commit is contained in:
Alex Garcia 2026-09-15 11:09:41 -07:00 committed by Simon Willison
commit cca08d2886
7 changed files with 454 additions and 5 deletions

View file

@ -53,6 +53,13 @@ def test_hook_jump_items_sql():
assert "jump_items_sql" in dir(pm.hook)
def test_hook_shutdown():
# Detailed behavior (ordering against background-task cancellation and
# close(), idempotency, exception handling, sync vs async support) is
# covered in tests/test_shutdown.py.
assert "shutdown" in dir(pm.hook)
@pytest.mark.asyncio
async def test_hook_plugins_dir_plugin_prepare_connection(ds_client):
response = await ds_client.get(