summaryrefslogtreecommitdiffhomepage
path: root/test/python/lifespan/failed/asgi.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/python/lifespan/failed/asgi.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/python/lifespan/failed/asgi.py b/test/python/lifespan/failed/asgi.py
new file mode 100644
index 00000000..8f315f70
--- /dev/null
+++ b/test/python/lifespan/failed/asgi.py
@@ -0,0 +1,11 @@
+async def application(scope, receive, send):
+ if scope['type'] == 'lifespan':
+ while True:
+ message = await receive()
+ if message['type'] == 'lifespan.startup':
+ await send({"type": "lifespan.startup.failed"})
+ raise Exception('Exception blah')
+
+ elif message['type'] == 'lifespan.shutdown':
+ await send({'type': 'lifespan.shutdown.complete'})
+ return