mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 02:37:41 -05:00
PyTerminal: use Pyodide instead of Python (#1833)
This commit is contained in:
committed by
GitHub
parent
aef028be6e
commit
3e2a67d434
@@ -40,6 +40,24 @@ class TestPyTerminal(PyScriptTest):
|
||||
self.page.keyboard.press("Enter")
|
||||
self.page.get_by_text("the answer is 42").wait_for()
|
||||
|
||||
@only_worker
|
||||
def test_py_terminal_os_write(self):
|
||||
"""
|
||||
An `os.write("text")` should land in the terminal
|
||||
"""
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<script type="py" terminal>
|
||||
import os
|
||||
os.write(1, str.encode("hello\\n"))
|
||||
os.write(2, str.encode("world\\n"))
|
||||
</script>
|
||||
""",
|
||||
wait_for_pyscript=False,
|
||||
)
|
||||
self.page.get_by_text("hello\n").wait_for()
|
||||
self.page.get_by_text("world\n").wait_for()
|
||||
|
||||
def test_py_terminal(self):
|
||||
"""
|
||||
1. <py-terminal> should redirect stdout and stderr to the DOM
|
||||
|
||||
Reference in New Issue
Block a user