mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 12:12:59 -05:00
Introduce DeprecatedGlobal and show proper warnings (#1014)
* kill the PyScript class and the weird pyscript instance; from the user point of view its functionalities are still available as pyscript.*, but pyscript is not the module, not the instance of PyScript * simplify the code in _set_version_info, while I'm at it * start to implement DeprecatedGlobal * DeprecatedGlobal.__getattr__ * don't show the same warning twice * DeprecatedGlobal.__call__ * make it possible to specify a different warning message for every global * WIP: carefully use DeprecatedGlobal to show reasonable warning messages depending on which name you are accessing to. More names to follow * deprecate more names * deprecate private names * depreacte direct usage of console and document * deprecate the PyScript class * use a better error message * fix test_pyscript.py * introduce a __repr__ for DeprecatedGlobal * add an helper to ensure that we don't show any error or warning on the page * WIP: ensure that examples don't use depreacted features. Many tests are failing * don't deprecate Element * don't use the global micropip to install packages, else we trigger a warning * use a better error message for micropip * fix test_todo_pylist to avoid using deprecated globals * fix test_webgl_raycaster * fix tests * make HTML globally available * add MIME_RENDERERS and MIME_METHODS * fix the typing of Micropip, thanks to @FabioRosado
This commit is contained in:
@@ -292,6 +292,17 @@ class PyScriptTest:
|
||||
elems = [loc.nth(i) for i in range(n)]
|
||||
return iter(elems)
|
||||
|
||||
def assert_no_banners(self):
|
||||
"""
|
||||
Ensure that there are no alert banners on the page, which are used for
|
||||
errors and warnings. Raise AssertionError if any if found.
|
||||
"""
|
||||
loc = self.page.locator(".alert-banner")
|
||||
n = loc.count()
|
||||
if n > 0:
|
||||
text = "\n".join(loc.all_inner_texts())
|
||||
raise AssertionError(f"Found {n} alert banners:\n" + text)
|
||||
|
||||
|
||||
# ============== Helpers and utility functions ==============
|
||||
|
||||
|
||||
Reference in New Issue
Block a user