Skip to content

Bump websockets to 9 #214

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

Merged
Merged
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
5 changes: 3 additions & 2 deletions gql/transport/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import websockets
from graphql import DocumentNode, ExecutionResult, print_ast
from websockets.client import WebSocketClientProtocol
from websockets.datastructures import HeadersLike
from websockets.exceptions import ConnectionClosed
from websockets.http import HeadersLike
from websockets.typing import Data, Subprotocol

from .async_transport import AsyncTransport
Expand Down Expand Up @@ -573,7 +573,8 @@ async def connect(self) -> None:
# Set the _connecting flag to False after in all cases
try:
self.websocket = await asyncio.wait_for(
websockets.connect(self.url, **connect_args,), self.connect_timeout,
websockets.client.connect(self.url, **connect_args,),
self.connect_timeout,
)
finally:
self._connecting = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
]

install_websockets_requires = [
"websockets>=8.1,<9",
"websockets>=9,<10",
]

install_all_requires = (
Expand Down
8 changes: 3 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def go(app, *, port=None, **kwargs): # type: ignore


# Adding debug logs to websocket tests
for name in ["websockets.server", "gql.transport.websockets", "gql.dsl"]:
for name in ["websockets.legacy.server", "gql.transport.websockets", "gql.dsl"]:
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)

Expand All @@ -125,7 +125,7 @@ def __init__(self, with_ssl: bool = False):

async def start(self, handler):

import websockets
from websockets.legacy import server

print("Starting server")

Expand All @@ -149,9 +149,7 @@ async def start(self, handler):
extra_serve_args["ssl"] = ssl_context

# Start a server with a random open port
self.start_server = websockets.server.serve(
handler, "127.0.0.1", 0, **extra_serve_args
)
self.start_server = server.serve(handler, "127.0.0.1", 0, **extra_serve_args)

# Wait that the server is started
self.server = await self.start_server
Expand Down