summaryrefslogtreecommitdiffstats
path: root/lang/python/python-uvicorn/test.sh
blob: 0b02336baa70d8fe07d6c2fc46dd54778df20e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

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

python3 - << 'EOF'

import uvicorn

# Config.load() imports and wires the HTTP/WS protocol backends (h11, etc.)
# for a trivial ASGI app - a real functional check that never binds a port.
async def app(scope, receive, send):
    pass

cfg = uvicorn.Config(app, host="127.0.0.1", port=8000, log_level="warning", loop="asyncio")
cfg.load()
assert cfg.loaded is True
assert uvicorn.Server(cfg).config is cfg

EOF