Add display impl, rm outputManage, print and console.log default to browser console (#749)

* Add display impl, remove outputManage, print and console.log defaults to terminal

* Fixing tests

* Lint

* Erase unecessary code, add cuter CSS formating for errors, fix problems around REPL output

* Add fix to repl2 and lint

* lint

* Allow for list of display, fix elif to else

* Add better global option

* test work

* xfails

* (antocuni, mariana): let's try to start again with TDD methodology: write the minimum test and code for a simple display()

* (antocuni, mariana): this test works out of the box

* WIP: this test is broken, mariana is going to fix it

* add a failing test

* Add ability to deal with targets

* Add append arg and append tests

* Add multiple values to display

* Small adjustments to tests. I noticed I wasn;t running all at some point

* add display test

* Add console tests

* Add async tests

* Fix repl tests

* Fixing merging issues

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Address antocuni's review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixing more tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* linting

* Improve repl tests

* Change my test so codespell is hapy with it

* Test: change test_runtime_config to use json instead of toml to see if stops failing on CI

* kill this file: it is a merge artifact since it was renamed into test_py_config.py on the main branch

* Change test execution order and add async tests to async test file

Co-authored-by: Antonio Cuni <anto.cuni@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Mariana Meireles
2022-10-17 16:28:40 +02:00
committed by GitHub
parent beb3aa1574
commit 1587273868
18 changed files with 459 additions and 180 deletions

View File

@@ -258,20 +258,18 @@ class TestExamples(PyScriptTest):
assert self.page.title() == "REPL"
wait_for_render(self.page, "*", "<py-repl.*?>")
self.page.locator("py-repl").type("print('Hello, World!')")
self.page.locator("py-repl").type("display('Hello, World!')")
self.page.locator("button").click()
assert self.page.locator("#my-repl-1").text_content() == "Hello, World!"
assert self.page.locator("#my-repl-2").text_content() == "Hello, World!"
# Confirm that using the second repl still works properly
self.page.locator("#my-repl-2").type("2*2")
self.page.locator("#my-repl-2").type("display(2*2)")
self.page.keyboard.press("Shift+Enter")
# Make sure that the child of the second repl is attached properly
# before looking into the text_content
second_repl_result = self.page.wait_for_selector(
"#my-repl-2-2", state="attached"
)
assert second_repl_result.text_content() == "4"
assert self.page.wait_for_selector("#my-repl-2-1", state="attached")
assert self.page.locator("#my-repl-2-1").text_content() == "4"
def test_repl2(self):
self.goto("examples/repl2.html")
@@ -279,7 +277,7 @@ class TestExamples(PyScriptTest):
assert self.page.title() == "Custom REPL Example"
wait_for_render(self.page, "*", "<py-repl.*?>")
# confirm we can import utils and run one command
self.page.locator("py-repl").type("import utils\nutils.now()")
self.page.locator("py-repl").type("import utils\ndisplay(utils.now())")
self.page.locator("button").click()
# Make sure the output is in the page
self.page.wait_for_selector("#output")