8000 improve this test · pyscript/pyscript@abb4598 · GitHub
[go: up one dir, main page]

Skip to content

Commit abb4598

Browse files
committed
improve this test
1 parent ae9ad5f commit abb4598

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pyscript.core/tests/integration/test_01_basic.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,25 @@ def test_execution_thread(self):
4343
in_worker = str(in_worker).lower()
4444
assert self.console.log.lines[-1] == f"worker? {in_worker}"
4545

46-
# TODO: if there's no py-script there are surely no plugins neither
47-
# this test must be discussed or rewritten to make sense now
48-
@pytest.mark.skip(reason="NEXT: No banner and should also add a WARNING about CORS")
46+
@skip_worker('NEXT: it should show a nice error on the page')
4947
def test_no_cors_headers(self):
5048
self.disable_cors_headers()
5149
self.pyscript_run(
5250
"""
53-
<!-- we don't really need anything here, we just want to check that
54-
pyscript starts -->
51+
<script type="py">
52+
import js
53+
js.console.log("hello")
54+
</script>
5555
""",
5656
wait_for_pyscript=False,
5757
)
5858
assert self.headers == {}
59-
if self.execution_thread == "worker":
59+
if self.execution_thread == "main":
60+
self.wait_for_pyscript()
61+
assert self.console.log.lines == ['hello']
62+
self.assert_no_banners()
63+
else:
64+
# XXX adapt and fix the test
6065
expected_alert_banner_msg = (
6166
'(PY1000): When execution_thread is "worker", the site must be cross origin '
6267
"isolated, but crossOriginIsolated is false. To be cross origin isolated, "
@@ -67,8 +72,7 @@ def test_no_cors_headers(self):
6772
)
6873
alert_banner = self.page.wait_for_selector(".alert-banner")
6974
assert expected_alert_banner_msg in alert_banner.inner_text()
70-
else:
71-
self.assert_no_banners()
75+
7276

7377
def test_print(self):
7478
self.pyscript_run(

0 commit comments

Comments
 (0)
0