Fix #1777 - Export also PyWorker and current_target (#1779)

This commit is contained in:
Andrea Giammarchi
2023-10-02 16:02:34 +02:00
committed by GitHub
parent bc1cac9c41
commit a08f891b20
4 changed files with 14 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@pyscript/core",
"version": "0.2.5",
"version": "0.2.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@pyscript/core",
"version": "0.2.5",
"version": "0.2.7",
"license": "APACHE-2.0",
"dependencies": {
"@ungap/with-resolvers": "^0.1.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@pyscript/core",
"version": "0.2.5",
"version": "0.2.7",
"type": "module",
"description": "PyScript",
"module": "./index.js",

View File

@@ -29,7 +29,7 @@
# pyscript.magic_js. This is the blessed way to access them from pyscript,
# as it works transparently in both the main thread and worker cases.
from pyscript.magic_js import RUNNING_IN_WORKER, window, document, sync
from pyscript.magic_js import RUNNING_IN_WORKER, PyWorker, window, document, sync, current_target
from pyscript.display import HTML, display
try:

View File

@@ -6,6 +6,16 @@ from .support import PyScriptTest, skip_worker, only_main
class TestBasic(PyScriptTest):
def test_pyscript_exports(self):
self.pyscript_run(
"""
<script type="py">
from pyscript import RUNNING_IN_WORKER, PyWorker, window, document, sync, current_target
</script>
"""
)
assert self.console.error.lines == []
def test_script_py_hello(self):
self.pyscript_run(
"""