Skip to content
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
4 changes: 4 additions & 0 deletions src/websockets/asyncio/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def unix_route(
) -> Awaitable[Server]:
raise ImportError("unix_route() requires werkzeug")

class Router:
def __init__(self, *args: Any, **kwargs: Any) -> None:
raise ImportError("Router() requires werkzeug")

else:

class Router:
Expand Down
4 changes: 4 additions & 0 deletions src/websockets/sync/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def unix_route(
) -> Server:
raise ImportError("unix_route() requires werkzeug")

class Router:
def __init__(self, *args: Any, **kwargs: Any) -> None:
raise ImportError("Router() requires werkzeug")

else:

class Router:
Expand Down
1 change: 1 addition & 0 deletions tests/asyncio/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ async def handler(self, connection):


@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "this test requires Unix sockets")
@unittest.skipUnless("werkzeug" in sys.modules, "werkzeug not installed")
class UnixRouterTests(EvalShellMixin, unittest.IsolatedAsyncioTestCase):
async def test_router_supports_unix_sockets(self):
"""Router supports Unix sockets."""
Expand Down
1 change: 1 addition & 0 deletions tests/sync/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def handler(self, connection):


@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "this test requires Unix sockets")
@unittest.skipUnless("werkzeug" in sys.modules, "werkzeug not installed")
class UnixRouterTests(EvalShellMixin, unittest.IsolatedAsyncioTestCase):
def test_router_supports_unix_sockets(self):
"""Router supports Unix sockets."""
Expand Down
Loading