Retain path structure for loading paths (#845)

* update retain dir structure logic to use emscripten FS APIs

* remove unused import

* replace error message
This commit is contained in:
Madhur Tandon
2022-10-27 20:08:58 +05:30
committed by GitHub
parent bf4d835948
commit ab085c2d92
4 changed files with 38 additions and 7 deletions

View File

@@ -117,6 +117,27 @@ class TestBasic(PyScriptTest):
inner_html = self.page.locator(".py-error").inner_html()
assert errorContent in inner_html
def test_paths_from_packages(self):
self.writefile("utils/__init__.py", "")
self.writefile("utils/a.py", "x = 'hello from A'")
self.pyscript_run(
"""
<py-config>
paths = ["./utils/__init__.py", "./utils/a.py"]
</py-config>
<py-script>
import js
from utils.a import x
js.console.log(x)
</py-script>
"""
)
assert self.console.log.lines == [
self.PY_COMPLETE,
"hello from A",
]
def test_packages(self):
self.pyscript_run(
"""