Skip to content
Open
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ test = [
"types-setuptools",
"pytest",
"pytest-timeout",
"pytest-rerunfailures",
"pytest-env",
"httpx",
"httpx-ws >=0.4.1",
Expand Down
7 changes: 6 additions & 1 deletion tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ async def recv(self) -> bytes:


@pytest.mark.anyio
@pytest.mark.flaky(reruns=2)
@pytest.mark.parametrize("auth_mode", ("noauth",))
async def test_execute(auth_mode, unused_tcp_port):
url = f"http://127.0.0.1:{unused_tcp_port}"
Expand Down Expand Up @@ -152,7 +153,11 @@ def callback(aevent, events, event):
):
# connect to the shared notebook document
# wait for file to be loaded and Y model to be created in server and client
await anyio.sleep(0.5)
with anyio.fail_after(1):
while True:
await anyio.sleep(0.1)
if len(ynb.ycells) >= 2:
break
# execute notebook
for cell_idx in range(2):
response = await http.post(
Expand Down
12 changes: 10 additions & 2 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ def callback(aevent, events, event):
):
# connect to the shared notebook document
# wait for file to be loaded and Y model to be created in server and client
await anyio.sleep(0.5)
with anyio.fail_after(1):
while True:
await anyio.sleep(0.1)
if len(ynb.ycells) >= 2:
break
# execute notebook
for cell_idx in range(2):
response = requests.post(
Expand Down Expand Up @@ -215,10 +219,14 @@ async def connect_ywidget(url, guid):
aconnect_ws(f"{url}/api/collaboration/room/ywidget:{guid}") as websocket,
WebsocketProvider(ywidget_doc, Websocket(websocket, guid)),
):
await anyio.sleep(0.5)
attrs = Map()
model_name = Text()
ywidget_doc["_attrs"] = attrs
ywidget_doc["_model_name"] = model_name
with anyio.fail_after(1):
while True:
await anyio.sleep(0.1)
if len(attrs) > 0:
break
assert str(model_name) == "Switch"
assert str(attrs) == '{"value":true}'
Loading