Skip to content

Commit 055a3fd

Browse files
committed
fix: update websockets, fix httpx test client
1 parent 11bfe35 commit 055a3fd

File tree

22 files changed

+122
-120
lines changed

22 files changed

+122
-120
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ dmypy.json
130130

131131
# System files
132132
.DS_Store
133+
134+
.idea

ariadne_codegen/client_generators/dependencies/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
)
2828

2929
try:
30-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
31-
WebSocketClientProtocol,
30+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
31+
ClientConnection,
3232
connect as ws_connect,
3333
)
3434
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -44,7 +44,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
4444
raise NotImplementedError("Subscriptions require 'websockets' package.")
4545
yield # pylint: disable=unreachable
4646

47-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
47+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
4848
Data = Any # type: ignore[misc,assignment,unused-ignore]
4949
Origin = Any # type: ignore[misc,assignment,unused-ignore]
5050

@@ -392,7 +392,7 @@ async def _execute_ws(
392392
if data:
393393
yield data
394394

395-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
395+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
396396
payload: Dict[str, Any] = {
397397
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
398398
}
@@ -402,7 +402,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
402402

403403
async def _send_subscribe(
404404
self,
405-
websocket: WebSocketClientProtocol,
405+
websocket: ClientConnection,
406406
operation_id: str,
407407
query: str,
408408
operation_name: Optional[str] = None,
@@ -422,7 +422,7 @@ async def _send_subscribe(
422422
async def _handle_ws_message(
423423
self,
424424
message: Data,
425-
websocket: WebSocketClientProtocol,
425+
websocket: ClientConnection,
426426
expected_type: Optional[GraphQLTransportWSMessageType] = None,
427427
) -> Optional[Dict[str, Any]]:
428428
try:
@@ -601,7 +601,7 @@ async def _execute_ws_with_telemetry(
601601
yield data
602602

603603
async def _send_connection_init_with_telemetry(
604-
self, root_span: Span, websocket: WebSocketClientProtocol
604+
self, root_span: Span, websocket: ClientConnection
605605
) -> None:
606606
with self.tracer.start_as_current_span( # type: ignore
607607
"connection init", context=set_span_in_context(root_span)
@@ -620,7 +620,7 @@ async def _send_connection_init_with_telemetry(
620620
async def _send_subscribe_with_telemetry(
621621
self,
622622
root_span: Span,
623-
websocket: WebSocketClientProtocol,
623+
websocket: ClientConnection,
624624
operation_id: str,
625625
query: str,
626626
operation_name: Optional[str] = None,
@@ -652,7 +652,7 @@ async def _handle_ws_message_with_telemetry(
652652
self,
653653
root_span: Span,
654654
message: Data,
655-
websocket: WebSocketClientProtocol,
655+
websocket: ClientConnection,
656656
expected_type: Optional[GraphQLTransportWSMessageType] = None,
657657
) -> Optional[Dict[str, Any]]:
658658
with self.tracer.start_as_current_span( # type: ignore

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dev = [
4545
"freezegun",
4646
"requests-toolbelt",
4747
]
48-
subscriptions = ["websockets~=11.0"]
48+
subscriptions = ["websockets>=14.2"]
4949
opentelemetry = ["opentelemetry-api"]
5050

5151
[project.scripts]

tests/main/clients/client_forward_refs/expected_client/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

tests/main/clients/custom_config_file/expected_client/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

tests/main/clients/custom_files_names/expected_client/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

tests/main/clients/custom_query_builder/expected_client/async_base_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
connect as ws_connect,
2222
)
2323
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -33,7 +33,7 @@ async def ws_connect(*args, **kwargs): # pylint: disable=unused-argument
3333
raise NotImplementedError("Subscriptions require 'websockets' package.")
3434
yield # pylint: disable=unreachable
3535

36-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
36+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3737
Data = Any # type: ignore[misc,assignment,unused-ignore]
3838
Origin = Any # type: ignore[misc,assignment,unused-ignore]
3939

@@ -302,7 +302,7 @@ async def _execute_json(
302302
**merged_kwargs,
303303
)
304304

305-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
305+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
306306
payload: Dict[str, Any] = {
307307
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
308308
}
@@ -312,7 +312,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
312312

313313
async def _send_subscribe(
314314
self,
315-
websocket: WebSocketClientProtocol,
315+
websocket: ClientConnection,
316316
operation_id: str,
317317
query: str,
318318
operation_name: Optional[str] = None,
@@ -332,7 +332,7 @@ async def _send_subscribe(
332332
async def _handle_ws_message(
333333
self,
334334
message: Data,
335-
websocket: WebSocketClientProtocol,
335+
websocket: ClientConnection,
336336
expected_type: Optional[GraphQLTransportWSMessageType] = None,
337337
) -> Optional[Dict[str, Any]]:
338338
try:

0 commit comments

Comments
 (0)