Skip to content

Commit

Permalink
test: make more robust by closing previous page sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Aug 30, 2023
1 parent 898f051 commit f72b02d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions solara/test/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ def SyncWrapper():
def solara_test(solara_server, solara_app, page_session: "playwright.sync_api.Page"):
global run_calls
with solara_app("solara.test.pytest_plugin:SyncWrapper"):
# a currently open page will try to connect to solara, creating a
# new context, so we navigate away first, then close all contexts
page_session.goto("about:blank")
for key in list(solara.server.app.contexts):
try:
solara.server.app.contexts[key].close()
except: # noqa
pass
assert len(solara.server.app.contexts) == 0
page_session.goto(solara_server.base_url)
run_event.wait()
assert run_calls == 1
Expand Down

0 comments on commit f72b02d

Please sign in to comment.