mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-22 11:45:28 -05:00
Upgrade to Pyodide 0.23 (#1347)
* Upgrade to Pyodide 0.23.2 * Update changelog * Use @param decorator to fix kmeans examlpe * Separate zz_example tests to run sequentially * Remove pytest.raises from pyscript_src_not_found test, use check_js_errors instead * Add 'check_js_errors' to wait_for_pyscript
This commit is contained in:
@@ -493,7 +493,13 @@ class PyScriptTest:
|
||||
return doc
|
||||
|
||||
def pyscript_run(
|
||||
self, snippet, *, extra_head="", wait_for_pyscript=True, timeout=None
|
||||
self,
|
||||
snippet,
|
||||
*,
|
||||
extra_head="",
|
||||
wait_for_pyscript=True,
|
||||
timeout=None,
|
||||
check_js_errors=True,
|
||||
):
|
||||
"""
|
||||
Main entry point for pyscript tests.
|
||||
@@ -517,7 +523,7 @@ class PyScriptTest:
|
||||
self.writefile(filename, doc)
|
||||
self.goto(filename)
|
||||
if wait_for_pyscript:
|
||||
self.wait_for_pyscript(timeout=timeout)
|
||||
self.wait_for_pyscript(timeout=timeout, check_js_errors=check_js_errors)
|
||||
|
||||
def iter_locator(self, loc):
|
||||
"""
|
||||
@@ -630,7 +636,7 @@ TEST_ITERATIONS = math.ceil(
|
||||
) # 120 iters of 1/4 second
|
||||
|
||||
|
||||
def wait_for_render(page, selector, pattern):
|
||||
def wait_for_render(page, selector, pattern, timeout_seconds: int | None = None):
|
||||
"""
|
||||
Assert that rendering inserts data into the page as expected: search the
|
||||
DOM from within the timing loop for a string that is not present in the
|
||||
@@ -639,7 +645,12 @@ def wait_for_render(page, selector, pattern):
|
||||
re_sub_content = re.compile(pattern)
|
||||
py_rendered = False # Flag to be set to True when condition met
|
||||
|
||||
for _ in range(TEST_ITERATIONS):
|
||||
if timeout_seconds:
|
||||
check_iterations = math.ceil(timeout_seconds / TEST_TIME_INCREMENT)
|
||||
else:
|
||||
check_iterations = TEST_ITERATIONS
|
||||
|
||||
for _ in range(check_iterations):
|
||||
content = page.inner_html(selector)
|
||||
if re_sub_content.search(content):
|
||||
py_rendered = True
|
||||
|
||||
Reference in New Issue
Block a user