Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make solara_test fixture not fail subsequent tests #316

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions solara/test/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,23 @@ def _solara_test(solara_server, solara_app, page_session: "playwright.sync_api.P
with context:
test_output_warmup = widgets.Output()
test_output = widgets.Output()
page_session.locator("text=Test in solara").wait_for()
context.container.children[0].children[1].children[1].children = [test_output_warmup] # type: ignore
with test_output_warmup:
warmup()
button = page_session.locator(".solara-warmup-widget")
button.wait_for()
page_session.evaluate("document.fonts.ready")
button.click()
button.wait_for(state="detached")
page_session.evaluate("document.fonts.ready")
context.container.children[0].children[1].children[1].children = [test_output] # type: ignore
with test_output:
yield
test_output.close()
try:
page_session.locator("text=Test in solara").wait_for()
context.container.children[0].children[1].children[1].children = [test_output_warmup] # type: ignore
with test_output_warmup:
warmup()
button = page_session.locator(".solara-warmup-widget")
button.wait_for()
page_session.evaluate("document.fonts.ready")
button.click()
button.wait_for(state="detached")
page_session.evaluate("document.fonts.ready")
context.container.children[0].children[1].children[1].children = [test_output] # type: ignore
with test_output:
yield
finally:
test_output.close()
test_output_warmup.close()
finally:
run_calls = 0
run_event.clear()
Expand Down
Loading