Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 26, 2024
1 parent 739462f commit 33fb438
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/test_yroom.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from pycrdt_websocket.yroom import YRoom
import pytest
from anyio.abc import TaskStatus
from anyio import TASK_STATUS_IGNORED, sleep
from anyio.abc import TaskStatus
from pycrdt import Map

from pycrdt_websocket import exception_logger
from pycrdt_websocket.yroom import YRoom

pytestmark = pytest.mark.anyio


@pytest.mark.parametrize("websocket_server_api", ["websocket_server_start_stop"], indirect=True)
@pytest.mark.parametrize("yws_server", [{"exception_handler": exception_logger}], indirect=True)
async def test_yroom_restart(yws_server, yws_provider):
Expand All @@ -19,14 +20,12 @@ async def raise_error(task_status: TaskStatus[None] = TASK_STATUS_IGNORED):
raise RuntimeError("foo")

yroom.ydoc = yws_provider
await server.start_room(yroom)
await server.start_room(yroom)
yroom.ydoc["map"] = ymap1 = Map()
ymap1["key"] = "value"
ymap1["key"] = "value"
await yroom._task_group.start(raise_error)
ymap1["key2"] = "value2"
ymap1["key2"] = "value2"
await sleep(0.1)
assert yroom._task_group is not None
assert not yroom._task_group.cancel_scope.cancel_called
await yroom.stop()


0 comments on commit 33fb438

Please sign in to comment.