Refactor named workers test to avoid circular dependencies + free CI (#2212)

* Refactor named workers test to avoid circular dependencies + free CI
This commit is contained in:
Andrea Giammarchi
2024-10-08 14:58:22 +02:00
committed by GitHub
parent febbb031ac
commit a6b6dd8479
15 changed files with 79 additions and 84 deletions

View File

@@ -1,19 +1,13 @@
from pyscript import document, workers
async def test(interpreter):
# accessed as item
named = await workers.micropython_version
async def test(name):
# retrieve sync utilities from the named worker
named = await workers[name]
version = await named.micropython_version()
# invoke the runtime_version __export__ + show it
version = await named.runtime_version()
document.body.append(version)
document.body.append(document.createElement("hr"))
# accessed as attribute
named = await workers["pyodide_version"]
version = await named.pyodide_version()
document.body.append(version)
document.body.append(document.createElement("hr"))
document.documentElement.classList.add(interpreter)
# flag the expectations around name done
document.documentElement.classList.add(name)