mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 22:00:25 -05:00
Move pyodide to a web worker (#1333)
This PR adds support for optionally running pyodide in a web worker: - add a new option config.execution_thread, which can be `main` or `worker`. The default is `main` - improve the test machinery so that we run all tests twice, once for `main` and once for `worker` - add a new esbuild target which builds the code for the worker The support for workers is not complete and many features are still missing: there are 71 tests which are marked as `@skip_worker`, but we can fix them in subsequent PRs. The vast majority of tests fail because js.document is unavailable: for it to run transparently, we need the "auto-syncify" feature of synclink. Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from .support import PyScriptTest
|
||||
from .support import PyScriptTest, with_execution_thread
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -35,6 +35,15 @@ def unzip(location, extract_to="."):
|
||||
file.extractall(path=extract_to)
|
||||
|
||||
|
||||
# Disable the main/worker dual testing, for two reasons:
|
||||
#
|
||||
# 1. the <py-config> logic happens before we start the worker, so there is
|
||||
# no point in running these tests twice
|
||||
#
|
||||
# 2. the logic to inject execution_thread into <py-config> works only with
|
||||
# plain <py-config> tags, but here we want to test all weird combinations
|
||||
# of config
|
||||
@with_execution_thread(None)
|
||||
class TestConfig(PyScriptTest):
|
||||
def test_py_config_inline(self):
|
||||
self.pyscript_run(
|
||||
|
||||
Reference in New Issue
Block a user