File
Blob: src/workerd/server/tests/python/pytest/main.py
| 1 | import os |
| 2 | |
| 3 | import pytest |
| 4 | from workers import WorkerEntrypoint |
| 5 | |
| 6 | from pyodide.webloop import WebLoop |
| 7 | |
| 8 | |
| 9 | async def noop(*args): |
| 10 | pass |
| 11 | |
| 12 | |
| 13 | # pytest-asyncio relies on these but in Pyodide < 0.29 WebLoop does not implement them |
| 14 | WebLoop.shutdown_asyncgens = noop |
| 15 | WebLoop.shutdown_default_executor = noop |
| 16 | |
| 17 | |
| 18 | class Default(WorkerEntrypoint): |
| 19 | async def test(self): |
| 20 | os.chdir("/session/metadata/tests") |
| 21 | assert pytest.main([".", "-vv"]) == 0 |