From 9870336fad3190bdc24e8862533229d4a0c7296d Mon Sep 17 00:00:00 2001 From: Taylor Lowery Date: Tue, 4 Jun 2024 22:44:02 +0000 Subject: [PATCH] wip: updating tests to follow AIOHTTPWebsockets protocol --- gql/transport/aiohttp_websockets.py | 1 - tests/conftest.py | 2 +- tests/test_aiohttp_websocket_exceptions.py | 4 ++-- tests/test_aiohttp_websocket_online.py | 0 4 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 tests/test_aiohttp_websocket_online.py diff --git a/gql/transport/aiohttp_websockets.py b/gql/transport/aiohttp_websockets.py index 9ddfe212..aa0000de 100644 --- a/gql/transport/aiohttp_websockets.py +++ b/gql/transport/aiohttp_websockets.py @@ -73,7 +73,6 @@ def __init__( ping_interval: Optional[Union[int, float]] = None, pong_timeout: Optional[Union[int, float]] = None, answer_pings: bool = True, - ) -> None: self.url: StrOrURL = url self.headers: Optional[LooseHeaders] = headers diff --git a/tests/conftest.py b/tests/conftest.py index 75b5ab9f..77802d00 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -460,7 +460,7 @@ async def client_and_server(server): async with Client(transport=sample_transport) as session: # Yield both client session and server - yield session, server@pytest_asyncio.fixture + yield session, server @pytest_asyncio.fixture async def aiohttp_client_and_server(server): diff --git a/tests/test_aiohttp_websocket_exceptions.py b/tests/test_aiohttp_websocket_exceptions.py index 0cba0de1..e6423208 100644 --- a/tests/test_aiohttp_websocket_exceptions.py +++ b/tests/test_aiohttp_websocket_exceptions.py @@ -149,7 +149,7 @@ async def test_aiohttp_websocket_sending_invalid_data( invalid_data = "QSDF" print(f">>> {invalid_data}") - await session.transport.websocket.send(invalid_data) + await session.transport.websocket.send_str(invalid_data) await asyncio.sleep(2 * MS) @@ -313,7 +313,7 @@ async def test_aiohttp_websocket_server_closing_after_ack( query = gql("query { hello }") - with pytest.raises(websockets.exceptions.ConnectionClosed): + with pytest.raises(ConnectionResetError): await session.execute(query) await session.transport.wait_closed() diff --git a/tests/test_aiohttp_websocket_online.py b/tests/test_aiohttp_websocket_online.py deleted file mode 100644 index e69de29b..00000000