Skip to content
File

Blob: src/workerd/server/tests/python/jspi/worker.py

python27 lines
1from asyncio import sleep
2 
3from pyodide import __version__
4 
5 
6def jspi_sleep():
7 if __version__ == "0.26.0a2":
8 print("JSPI not supported on 0.26.0a2, skipping")
9 return
10 
11 from pyodide.ffi import run_sync
12 
13 run_sync(sleep(0.1))
14 print("Okay")
15 
16 
17# TODO(EW-9316): the below test wasn't actually testing jspi at top-level because it only ran in
18# worker and workerd used to not run the top-level at the top-level... this was fixed and now the
19# below fails.
20# print("Testing JSPI at top level...")
21# jspi_sleep()
22 
23 
24def test():
25 print("Testing JSPI in handler...")
26 jspi_sleep()