mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-14 01:00:36 -05:00
Re-enable CI tests (#1760)
This re-enables CI tests on every PR 🎉.
This uses make test-integration, which runs tests sequentially.
In theory, we also have test-integration-parallel but it seems to be very flaky: many tests randomly timeout. I didn't spend too much time investigating this, it's probably worth its own investigation in a separate PR, but for now it's important to re-enable CI tests, even if they are a bit slower.
This commit is contained in:
@@ -11,26 +11,22 @@ class TestBasic(PyScriptTest):
|
||||
"""
|
||||
<script type="py">
|
||||
import js
|
||||
js.console.log('1. hello from script py')
|
||||
js.console.log('hello from script py')
|
||||
</script>
|
||||
"""
|
||||
)
|
||||
assert self.console.log.lines == ["hello from script py"]
|
||||
|
||||
def test_py_script_hello(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-script>
|
||||
import js
|
||||
js.console.log('2. hello from py-script')
|
||||
js.console.log('hello from py-script')
|
||||
</py-script>
|
||||
"""
|
||||
)
|
||||
if self.execution_thread == "main":
|
||||
# in main, the order of execution is guaranteed
|
||||
assert self.console.log.lines == [
|
||||
"1. hello from script py",
|
||||
"2. hello from py-script",
|
||||
]
|
||||
else:
|
||||
# in workers, each tag is executed by its own worker, so they can
|
||||
# come out of order
|
||||
lines = sorted(self.console.log.lines)
|
||||
assert lines == ["1. hello from script py", "2. hello from py-script"]
|
||||
assert self.console.log.lines == ["hello from py-script"]
|
||||
|
||||
def test_execution_thread(self):
|
||||
self.pyscript_run(
|
||||
@@ -47,20 +43,25 @@ class TestBasic(PyScriptTest):
|
||||
in_worker = str(in_worker).lower()
|
||||
assert self.console.log.lines[-1] == f"worker? {in_worker}"
|
||||
|
||||
# TODO: if there's no py-script there are surely no plugins neither
|
||||
# this test must be discussed or rewritten to make sense now
|
||||
@pytest.mark.skip(reason="NEXT: No banner and should also add a WARNING about CORS")
|
||||
@skip_worker('NEXT: it should show a nice error on the page')
|
||||
def test_no_cors_headers(self):
|
||||
self.disable_cors_headers()
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<!-- we don't really need anything here, we just want to check that
|
||||
pyscript starts -->
|
||||
<script type="py">
|
||||
import js
|
||||
js.console.log("hello")
|
||||
</script>
|
||||
""",
|
||||
wait_for_pyscript=False,
|
||||
)
|
||||
assert self.headers == {}
|
||||
if self.execution_thread == "worker":
|
||||
if self.execution_thread == "main":
|
||||
self.wait_for_pyscript()
|
||||
assert self.console.log.lines == ['hello']
|
||||
self.assert_no_banners()
|
||||
else:
|
||||
# XXX adapt and fix the test
|
||||
expected_alert_banner_msg = (
|
||||
'(PY1000): When execution_thread is "worker", the site must be cross origin '
|
||||
"isolated, but crossOriginIsolated is false. To be cross origin isolated, "
|
||||
@@ -71,8 +72,7 @@ class TestBasic(PyScriptTest):
|
||||
)
|
||||
alert_banner = self.page.wait_for_selector(".alert-banner")
|
||||
assert expected_alert_banner_msg in alert_banner.inner_text()
|
||||
else:
|
||||
self.assert_no_banners()
|
||||
|
||||
|
||||
def test_print(self):
|
||||
self.pyscript_run(
|
||||
|
||||
Reference in New Issue
Block a user