mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 02:37:41 -05:00
use emscripten virtual FS directly to load paths (#870)
* use emscripten virtual FS directly to load paths * use more low level APIs * use await instead of then * remove try...catch from loadFromFile since it's being handled externally * add test for an invalid path * test checks for error shown to the user too * add comment about a missing case
This commit is contained in:
@@ -75,6 +75,27 @@ class TestBasic(PyScriptTest):
|
||||
"hello from B",
|
||||
]
|
||||
|
||||
def test_paths_that_do_not_exist(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-config>
|
||||
paths = ["./f.py"]
|
||||
</py-config>
|
||||
"""
|
||||
)
|
||||
assert self.console.error.lines == ["Failed to load resource: net::ERR_FAILED"]
|
||||
assert self.console.warning.lines == [
|
||||
"Caught an error in fetchPaths:\r\n TypeError: Failed to fetch"
|
||||
]
|
||||
|
||||
errorContent = """PyScript: Access to local files
|
||||
(using "Paths:" in <py-config>)
|
||||
is not available when directly opening a HTML file;
|
||||
you must use a webserver to serve the additional files."""
|
||||
|
||||
inner_html = self.page.locator(".py-error").inner_html()
|
||||
assert errorContent in inner_html
|
||||
|
||||
def test_packages(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user