summaryrefslogtreecommitdiffstats
path: root/lang/python/python-sniffio/test.sh
blob: 861fa927cb0d95fcf9b1ebee3d2a36493215827d (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
#!/bin/sh

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

python3 - << EOF
import sys
import sniffio

if sniffio.__version__ != "$2":
    print("Wrong version: " + sniffio.__version__)
    sys.exit(1)

from sniffio import current_async_library
from sniffio import AsyncLibraryNotFoundError

# Outside async context should raise
try:
    current_async_library()
    sys.exit(1)
except AsyncLibraryNotFoundError:
    pass

sys.exit(0)
EOF