From f1f9efa946fc1998989854b424a22f09a23bab94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Sun, 13 Oct 2024 19:39:47 +0000 Subject: [PATCH] cleanup --- RELEASE.md | 3 +-- tests/http/clients/litestar.py | 4 ++++ tests/websockets/test_graphql_transport_ws.py | 20 ++++--------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 2820214c74..8f6812b821 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,3 @@ Release type: patch -Operations over `graphql-transport-ws` now create the Context and perform validation on -the worker `Task`, thus not blocking the websocket from accepting messages. +Fix error handling for query operations over graphql-transport-ws \ No newline at end of file diff --git a/tests/http/clients/litestar.py b/tests/http/clients/litestar.py index b29be52b32..2548dc563c 100644 --- a/tests/http/clients/litestar.py +++ b/tests/http/clients/litestar.py @@ -29,6 +29,10 @@ ) +def custom_context_dependency() -> str: + return "Hi!" + + async def litestar_get_context(request: Request = None): return get_context({"request": request}) diff --git a/tests/websockets/test_graphql_transport_ws.py b/tests/websockets/test_graphql_transport_ws.py index e4cd0ad109..f996d0da33 100644 --- a/tests/websockets/test_graphql_transport_ws.py +++ b/tests/websockets/test_graphql_transport_ws.py @@ -30,23 +30,8 @@ from tests.http.clients.base import DebuggableGraphQLTransportWSHandler from tests.views.schema import MyExtension, Schema -from ..http.clients.base import WebSocketClient - -try: - from ..http.clients.fastapi import FastAPIHttpClient -except ImportError: # pragma: no cover - FastAPIHttpClient = None -try: - from ..http.clients.starlite import StarliteHttpClient -except ImportError: # pragma: no cover - StarliteHttpClient = None -try: - from ..http.clients.litestar import LitestarHttpClient -except ImportError: # pragma: no cover - LitestarHttpClient = None - if TYPE_CHECKING: - from ..http.clients.base import HttpClient + from ..http.clients.base import HttpClient, WebSocketClient @pytest_asyncio.fixture @@ -912,6 +897,9 @@ async def test_error_handler_for_timeout(http_client: HttpClient): if isinstance(http_client, ChannelsHttpClient): pytest.skip("Can't patch on_init for this client") + + if not AsyncMock: + pytest.skip("Don't have AsyncMock") ws = ws_raw handler = None