summaryrefslogtreecommitdiffstats
path: root/lang/python/python-engineio/test.sh
blob: 76a856a7bd8be1201e4938816e358cd07b2dfb87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

[ "$1" = "python3-engineio" ] || exit 0

python3 - << EOF
import sys

# Verify key classes are importable
from engineio import Server, AsyncServer, WSGIApp, ASGIApp

# AsyncServer with asgi mode needs no external dependencies
asrv = AsyncServer(async_mode='asgi')
assert asrv is not None

received = []

@asrv.on("connect")
async def on_connect(sid, environ):
    received.append(("connect", sid))

@asrv.on("disconnect")
async def on_disconnect(sid):
    received.append(("disconnect", sid))

# ASGI app wrapper
aapp = ASGIApp(asrv)
assert aapp is not None

sys.exit(0)
EOF