Bootstrap python tests (#697)

* move current integration tests to the integration folder

* move pyscript.py into its own python folder

* change the path for python unit testing files

* change pyscript.py path

* Update Makefile

* remove echo

* replace conda run with pytest directly

* oops, add python test files I embarrassingly forgot to add

Co-authored-by: Peter W <34256109+pww217@users.noreply.github.com>
This commit is contained in:
Fabio Pliger
2022-08-18 16:59:07 -05:00
committed by GitHub
parent 8aba271a42
commit fa7a97ca30
15 changed files with 47 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
import pytest
from .support import PyScriptTest
class TestPyButton(PyScriptTest):
@pytest.mark.xfail
def test_on_click(self):
"""
currently this test fails for a bad reason which is unrelated to
py-button. During the page loading, the following JS exception occur,
in base.ts:BaseEvalElement.evaluate
[JS exception ] TypeError: Cannot use 'in' operator to search for 'runPythonAsync' in undefined
at http://127.0.0.1:8080/build/pyscript.js:305:38
at Object.subscribe (http://127.0.0.1:8080/build/pyscript.js:46:13)
at PyButton.runAfterRuntimeInitialized (http://127.0.0.1:8080/build/pyscript.js:304:27)
at PyButton.connectedCallback (http://127.0.0.1:8080/build/pyscript.js:26856:18)
at http://127.0.0.1:8080/build/pyscript.js:27075:20
at http://127.0.0.1:8080/build/pyscript.js:27093:3
""" # noqa: E501
self.pyscript_run(
"""
<py-button label="my button">
import js
def on_click(evt):
js.console.info('clicked!')
</py-button>
"""
)
assert self.console.info.lines == []
self.page.locator("text=my button").click()
self.page.locator("text=my button").click()
assert self.console.info.lines == ["clicked!", "clicked!"]