mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 22:00:25 -05:00
Handle non-200 code when fetch py-script src (#940)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from .support import PyScriptTest
|
||||
import pytest
|
||||
|
||||
from .support import JsErrors, PyScriptTest
|
||||
|
||||
|
||||
class TestBasic(PyScriptTest):
|
||||
@@ -126,3 +128,22 @@ class TestBasic(PyScriptTest):
|
||||
self.PY_COMPLETE,
|
||||
"hello from foo",
|
||||
]
|
||||
|
||||
def test_py_script_src_not_found(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-script src="foo.py"></py-script>
|
||||
"""
|
||||
)
|
||||
assert self.console.log.lines == [
|
||||
self.PY_COMPLETE,
|
||||
]
|
||||
assert "Failed to load resource" in self.console.error.lines[0]
|
||||
with pytest.raises(JsErrors) as exc:
|
||||
self.check_js_errors()
|
||||
|
||||
error_msg = str(exc.value)
|
||||
assert "Failed to fetch" in error_msg
|
||||
|
||||
pyscript_tag = self.page.locator("py-script")
|
||||
assert pyscript_tag.inner_html() == ""
|
||||
|
||||
Reference in New Issue
Block a user