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

CI stability testing #163

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions solara/server/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,18 @@ def send_websockets(websockets: Set[websocket.WebsocketWrapper], binary_msg):
try:
ws.send(binary_msg)
except: # noqa
# in case of any issue, we simply remove it from the list
websockets.remove(ws)
# use discard because via the frontend we also send
# window.navigator.sendBeacon(close_url);
# which executes in a different thread and can cause
# the websocket to be removed because both threads
# are blocking on the above send call
websockets.discard(ws)


class SessionWebsocket(session.Session):
def __init__(self, *args, **kwargs):
super(SessionWebsocket, self).__init__(*args, **kwargs)
self.websockets: Set[websocket.WebsocketWrapper] = set() # map from .. msg id to websocket?
self.websockets: Set[websocket.WebsocketWrapper] = set()

def send(self, stream, msg_or_type, content=None, parent=None, ident=None, buffers=None, track=False, header=None, metadata=None):
try:
Expand Down
2 changes: 1 addition & 1 deletion solara/server/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def model_id_debug(self: ipywidgets.widgets.widget.Widget):
import solara.comm

if self.comm is None and id(self) in closed_ids and id(self) in closed_stack:
raise RuntimeError(f"Widget has been closed, the stacktrace when the widget was closed is:\n{closed_stack[id(self)]}")
raise RuntimeError(f"Widget {type(self)} has been closed, the stacktrace when the widget was closed is:\n{closed_stack[id(self)]}")

if self.comm is None or isinstance(self.comm, solara.comm.DummyComm) and force_load_instance.comm is not self.comm:
stack = solara.comm.orphan_comm_stacks.get(self.comm)
Expand Down
6 changes: 6 additions & 0 deletions solara/test/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def context_session(
@pytest.fixture(scope="session")
def page_session(context_session: "playwright.sync_api.BrowserContext"):
page = context_session.new_page()

def log(msg):
print("PAGE LOG:", msg.text) # noqa
logger.debug("PAGE LOG: %s", msg.text)

# page.on("console", log)
yield page
page.close()

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/widget_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .conftest import SERVERS


def test_widget_button_solara(solara_test, page_session: playwright.sync_api.Page, assert_solara_snapshot):
def _test_widget_button_solara(solara_test, page_session: playwright.sync_api.Page, assert_solara_snapshot):
# this all runs in process, which only works with solara
# also, this test is only with pure ipywidgets
button = widgets.Button(description="Click Me!")
Expand Down