Skip to content

Commit 0243e1e

Browse files
committed
format and linting, update requirements.txt in fastapi integration tests to fix Starlette TestClient error, manually set anyio dependency lower for python 3.8 integration tests as current version is not available for 3.8
1 parent eeea4f1 commit 0243e1e

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

ariadne/asgi/handlers/http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ async def handle(self, scope: Scope, receive: Receive, send: Send) -> None:
9393
response = await self.handle_request(request)
9494
await response(scope, receive, send)
9595

96-
async def handle_request_override(self, request: Request) -> Optional[Response]:
96+
async def handle_request_override(self, _: Request) -> Optional[Response]:
9797
"""Override the default request handling logic in subclasses.
9898
Is called in the `handle_request` method before the default logic.
9999
If None is returned, the default logic is executed.
100100
101101
# Required arguments:
102-
`request`: the `Request` instance from Starlette or FastAPI.
102+
`_`: the `Request` instance from Starlette or FastAPI.
103103
"""
104104
return None
105105

ariadne/contrib/sse.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ async def _ping(self, send: Send) -> None:
209209
await send(
210210
{
211211
"type": "http.response.body",
212-
# always encode as utf-8 as per https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
212+
# always encode as utf-8 as per
213+
# https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
213214
"body": ":\r\n\r\n".encode("utf-8"),
214215
"more_body": True,
215216
}
@@ -276,15 +277,17 @@ def encode_event(event: GraphQLServerSentEvent) -> bytes:
276277
# Required arguments
277278
`event`: the GraphQLServerSentEvent object
278279
"""
279-
# always encode as utf-8 as per https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
280+
# always encode as utf-8 as per
281+
# https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
280282
return str(event).encode("utf-8")
281283

282284

283285
class GraphQLHTTPSSEHandler(GraphQLHTTPHandler):
284286
"""Extension to the default GraphQLHTTPHandler to also handle Server-Sent Events as per
285-
the GraphQL SSE Protocol specification. This handler only supports the defined `Distinct connections mode`
286-
due to its statelessness. This implementation is based on the specification as of commit
287-
80cf75b5952d1a065c95bdbd6a74304c90dbe2c5. For more information see the specification
287+
the GraphQL SSE Protocol specification. This handler only supports the defined
288+
`Distinct connections mode` due to its statelessness. This implementation is based on
289+
the specification as of commit 80cf75b5952d1a065c95bdbd6a74304c90dbe2c5.
290+
For more information see the specification
288291
(https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md)
289292
"""
290293

tests/asgi/test_sse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_ping_is_send_sse(sse_client):
179179
def test_custom_ping_interval(schema):
180180
app = GraphQL(
181181
schema,
182-
http_handler=GraphQLHTTPSSEHandler(ping_interval=10),
182+
http_handler=GraphQLHTTPSSEHandler(ping_interval=8),
183183
introspection=False,
184184
)
185185
sse_client = TestClient(app, headers=SSE_HEADER)
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
55
# pip-compile --output-file=requirements.txt requirements.in
66
#
7-
annotated-types==0.6.0
7+
annotated-types==0.7.0
88
# via pydantic
9-
anyio==3.7.1
9+
anyio==4.5.2
1010
# via starlette
11-
fastapi==0.109.1
11+
exceptiongroup==1.2.2
12+
# via anyio
13+
fastapi==0.115.6
1214
# via -r requirements.in
13-
idna==3.7
15+
idna==3.10
1416
# via anyio
15-
pydantic==2.4.2
17+
pydantic==2.10.3
1618
# via fastapi
17-
pydantic-core==2.10.1
19+
pydantic-core==2.27.1
1820
# via pydantic
19-
sniffio==1.3.0
21+
sniffio==1.3.1
2022
# via anyio
21-
starlette==0.35.1
23+
starlette==0.41.3
2224
# via fastapi
23-
typing-extensions==4.8.0
25+
typing-extensions==4.12.2
2426
# via
27+
# anyio
2528
# fastapi
2629
# pydantic
2730
# pydantic-core

0 commit comments

Comments
 (0)