-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from davidbrochart/auto-restart
Add WebsocketServer exception handler
- Loading branch information
Showing
5 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from .asgi_server import ASGIServer as ASGIServer | ||
from .websocket_provider import WebsocketProvider as WebsocketProvider | ||
from .websocket_server import WebsocketServer as WebsocketServer | ||
from .websocket_server import YRoom as YRoom | ||
from .websocket_server import exception_logger as exception_logger | ||
from .yroom import YRoom as YRoom | ||
from .yutils import YMessageType as YMessageType | ||
|
||
__version__ = "0.13.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
from anyio import sleep | ||
|
||
from pycrdt_websocket import exception_logger | ||
|
||
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_server_restart(yws_server): | ||
port, server = yws_server | ||
|
||
async def raise_error(): | ||
raise RuntimeError("foo") | ||
|
||
server._task_group.start_soon(raise_error) | ||
await sleep(0.1) |