Improve UX when we can't install a package (#1000)

This commit is contained in:
Fábio Rosado
2022-12-05 14:35:15 +00:00
committed by GitHub
parent 5aa9135a34
commit af60299324
5 changed files with 102 additions and 6 deletions

View File

@@ -101,6 +101,43 @@ class TestBasic(PyScriptTest):
"hello asciitree", # printed by us
]
def test_non_existent_package(self):
self.pyscript_run(
"""
<py-config>
packages = ["nonexistendright"]
</py-config>
""",
wait_for_pyscript=False,
)
expected_alert_banner_msg = (
"(PY1001): Unable to install package(s) 'nonexistendright'. "
"Unable to find package in PyPI. Please make sure you have "
"entered a correct package name."
)
alert_banner = self.page.wait_for_selector(".alert-banner")
assert expected_alert_banner_msg in alert_banner.inner_text()
def test_no_python_wheel(self):
self.pyscript_run(
"""
<py-config>
packages = ["opsdroid"]
</py-config>
""",
wait_for_pyscript=False,
)
expected_alert_banner_msg = (
"(PY1001): Unable to install package(s) 'opsdroid'. "
"Reason: Can't find a pure Python 3 Wheel for package(s) 'opsdroid'"
)
alert_banner = self.page.wait_for_selector(".alert-banner")
assert expected_alert_banner_msg in alert_banner.inner_text()
def test_dynamically_add_py_script_tag(self):
self.pyscript_run(
"""