Skip to content
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

Chore bump websockets to 13.x #532

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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
]

install_websockets_requires = [
"websockets>=10,<12",
"websockets>=10.1,<14",
]

install_botocore_requires = [
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def get_server_handler(request):
else:
answers = request.param

async def default_server_handler(ws, path):
async def default_server_handler(ws):

try:
await WebSocketServerHelper.send_connection_ack(ws)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_aiohttp_websocket_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def test_aiohttp_websocket_invalid_query(
"""


async def server_invalid_subscription(ws, path):
async def server_invalid_subscription(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.recv()
await ws.send(invalid_query1_server_answer.format(query_id=1))
Expand Down Expand Up @@ -108,7 +108,7 @@ async def test_aiohttp_websocket_invalid_subscription(
)


async def server_no_ack(ws, path):
async def server_no_ack(ws):
await ws.wait_closed()


Expand All @@ -129,7 +129,7 @@ async def test_aiohttp_websocket_server_does_not_send_ack(
pass


async def server_connection_error(ws, path):
async def server_connection_error(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}")
Expand Down Expand Up @@ -158,7 +158,7 @@ async def test_aiohttp_websocket_sending_invalid_data(
)


async def server_invalid_payload(ws, path):
async def server_invalid_payload(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}")
Expand Down Expand Up @@ -253,7 +253,7 @@ async def test_aiohttp_websocket_transport_protocol_errors(
await session.execute(query)


async def server_without_ack(ws, path):
async def server_without_ack(ws):
# Sending something else than an ack
await WebSocketServerHelper.send_complete(ws, 1)
await ws.wait_closed()
Expand All @@ -274,7 +274,7 @@ async def test_aiohttp_websocket_server_does_not_ack(event_loop, server):
pass


async def server_closing_directly(ws, path):
async def server_closing_directly(ws):
await ws.close()


Expand All @@ -294,7 +294,7 @@ async def test_aiohttp_websocket_server_closing_directly(event_loop, server):
pass


async def server_closing_after_ack(ws, path):
async def server_closing_after_ack(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.close()

Expand All @@ -313,7 +313,7 @@ async def test_aiohttp_websocket_server_closing_after_ack(
await session.execute(query)


async def server_sending_invalid_query_errors(ws, path):
async def server_sending_invalid_query_errors(ws):
await WebSocketServerHelper.send_connection_ack(ws)
invalid_error = (
'{"type":"error","id":"404","payload":'
Expand Down
12 changes: 6 additions & 6 deletions tests/test_aiohttp_websocket_graphqlws_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def test_aiohttp_websocket_graphqlws_invalid_query(
"""


async def server_invalid_subscription(ws, path):
async def server_invalid_subscription(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.recv()
await ws.send(invalid_query1_server_answer.format(query_id=1))
Expand Down Expand Up @@ -102,7 +102,7 @@ async def test_aiohttp_websocket_graphqlws_invalid_subscription(
assert error["extensions"]["code"] == "INTERNAL_SERVER_ERROR"


async def server_no_ack(ws, path):
async def server_no_ack(ws):
await ws.wait_closed()


Expand Down Expand Up @@ -130,7 +130,7 @@ async def test_aiohttp_websocket_graphqlws_server_does_not_send_ack(
)


async def server_invalid_query(ws, path):
async def server_invalid_query(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}")
Expand Down Expand Up @@ -207,7 +207,7 @@ async def test_aiohttp_websocket_graphqlws_transport_protocol_errors(
await session.execute(query)


async def server_without_ack(ws, path):
async def server_without_ack(ws):
# Sending something else than an ack
await WebSocketServerHelper.send_complete(ws, 1)
await ws.wait_closed()
Expand All @@ -230,7 +230,7 @@ async def test_aiohttp_websocket_graphqlws_server_does_not_ack(
pass


async def server_closing_directly(ws, path):
async def server_closing_directly(ws):
await ws.close()


Expand All @@ -252,7 +252,7 @@ async def test_aiohttp_websocket_graphqlws_server_closing_directly(
pass


async def server_closing_after_ack(ws, path):
async def server_closing_after_ack(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.close()

Expand Down
20 changes: 10 additions & 10 deletions tests/test_aiohttp_websocket_graphqlws_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
def server_countdown_factory(
keepalive=False, answer_pings=True, simulate_disconnect=False
):
async def server_countdown_template(ws, path):
async def server_countdown_template(ws):
import websockets

logged_messages.clear()
Expand Down Expand Up @@ -192,28 +192,28 @@ async def receiving_coro():
return server_countdown_template


async def server_countdown(ws, path):
async def server_countdown(ws):

server = server_countdown_factory()
await server(ws, path)
await server(ws)


async def server_countdown_keepalive(ws, path):
async def server_countdown_keepalive(ws):

server = server_countdown_factory(keepalive=True)
await server(ws, path)
await server(ws)


async def server_countdown_dont_answer_pings(ws, path):
async def server_countdown_dont_answer_pings(ws):

server = server_countdown_factory(answer_pings=False)
await server(ws, path)
await server(ws)


async def server_countdown_disconnect(ws, path):
async def server_countdown_disconnect(ws):

server = server_countdown_factory(simulate_disconnect=True)
await server(ws, path)
await server(ws)


countdown_subscription_str = """
Expand Down Expand Up @@ -353,7 +353,7 @@ async def close_transport_task_coro():
assert count > 0


async def server_countdown_close_connection_in_middle(ws, path):
async def server_countdown_close_connection_in_middle(ws):
await WebSocketServerHelper.send_connection_ack(ws)

result = await ws.recv()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_aiohttp_websocket_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ async def test_aiohttp_websocket_two_queries_in_series(
assert result1 == result2


async def server1_two_queries_in_parallel(ws, path):
async def server1_two_queries_in_parallel(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}", file=sys.stderr)
Expand Down Expand Up @@ -276,7 +276,7 @@ async def task2_coro():
assert result1 == result2


async def server_closing_while_we_are_doing_something_else(ws, path):
async def server_closing_while_we_are_doing_something_else(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}", file=sys.stderr)
Expand Down Expand Up @@ -434,7 +434,7 @@ async def test_aiohttp_websocket_trying_to_connect_to_already_connected_transpor
pass


async def server_with_authentication_in_connection_init_payload(ws, path):
async def server_with_authentication_in_connection_init_payload(ws):
# Wait the connection_init message
init_message_str = await ws.recv()
init_message = json.loads(init_message_str)
Expand Down Expand Up @@ -593,7 +593,7 @@ async def test_aiohttp_websocket_add_extra_parameters_to_connect(
await session.execute(query)


async def server_sending_keep_alive_before_connection_ack(ws, path):
async def server_sending_keep_alive_before_connection_ack(ws):
await WebSocketServerHelper.send_keepalive(ws)
await WebSocketServerHelper.send_keepalive(ws)
await WebSocketServerHelper.send_keepalive(ws)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_aiohttp_websocket_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}


async def server_starwars(ws, path):
async def server_starwars(ws):
import websockets

await WebSocketServerHelper.send_connection_ack(ws)
Expand Down Expand Up @@ -91,7 +91,7 @@ async def server_starwars(ws, path):
logged_messages: List[str] = []


async def server_countdown(ws, path):
async def server_countdown(ws):
import websockets

logged_messages.clear()
Expand Down Expand Up @@ -343,7 +343,7 @@ async def close_transport_task_coro():
assert count > 0


async def server_countdown_close_connection_in_middle(ws, path):
async def server_countdown_close_connection_in_middle(ws):
await WebSocketServerHelper.send_connection_ack(ws)

result = await ws.recv()
Expand Down
20 changes: 11 additions & 9 deletions tests/test_appsync_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def verify_headers(headers, in_query=False):
"errorCode": 400,
}

async def realtime_appsync_server_template(ws, path):
async def realtime_appsync_server_template(ws):
import websockets

logged_messages.clear()
Expand Down Expand Up @@ -139,6 +139,8 @@ async def realtime_appsync_server_template(ws, path):
)
return

path = ws.path

print(f"path = {path}")

path_base, parameters_str = path.split("?")
Expand Down Expand Up @@ -348,28 +350,28 @@ async def receiving_coro():
return realtime_appsync_server_template


async def realtime_appsync_server(ws, path):
async def realtime_appsync_server(ws):

server = realtime_appsync_server_factory()
await server(ws, path)
await server(ws)


async def realtime_appsync_server_keepalive(ws, path):
async def realtime_appsync_server_keepalive(ws):

server = realtime_appsync_server_factory(keepalive=True)
await server(ws, path)
await server(ws)


async def realtime_appsync_server_not_json_answer(ws, path):
async def realtime_appsync_server_not_json_answer(ws):

server = realtime_appsync_server_factory(not_json_answer=True)
await server(ws, path)
await server(ws)


async def realtime_appsync_server_error_without_id(ws, path):
async def realtime_appsync_server_error_without_id(ws):

server = realtime_appsync_server_factory(error_without_id=True)
await server(ws, path)
await server(ws)


on_create_message_subscription_str = """
Expand Down
2 changes: 1 addition & 1 deletion tests/test_async_client_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}


async def server_starwars(ws, path):
async def server_starwars(ws):
import websockets

await WebSocketServerHelper.send_connection_ack(ws)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_graphqlws_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def test_graphqlws_invalid_query(
"""


async def server_invalid_subscription(ws, path):
async def server_invalid_subscription(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.recv()
await ws.send(invalid_query1_server_answer.format(query_id=1))
Expand Down Expand Up @@ -102,7 +102,7 @@ async def test_graphqlws_invalid_subscription(
assert error["extensions"]["code"] == "INTERNAL_SERVER_ERROR"


async def server_no_ack(ws, path):
async def server_no_ack(ws):
await ws.wait_closed()


Expand Down Expand Up @@ -130,7 +130,7 @@ async def test_graphqlws_server_does_not_send_ack(
)


async def server_invalid_query(ws, path):
async def server_invalid_query(ws):
await WebSocketServerHelper.send_connection_ack(ws)
result = await ws.recv()
print(f"Server received: {result}")
Expand Down Expand Up @@ -205,7 +205,7 @@ async def test_graphqlws_transport_protocol_errors(
await session.execute(query)


async def server_without_ack(ws, path):
async def server_without_ack(ws):
# Sending something else than an ack
await WebSocketServerHelper.send_complete(ws, 1)
await ws.wait_closed()
Expand All @@ -226,7 +226,7 @@ async def test_graphqlws_server_does_not_ack(event_loop, graphqlws_server):
pass


async def server_closing_directly(ws, path):
async def server_closing_directly(ws):
await ws.close()


Expand All @@ -246,7 +246,7 @@ async def test_graphqlws_server_closing_directly(event_loop, graphqlws_server):
pass


async def server_closing_after_ack(ws, path):
async def server_closing_after_ack(ws):
await WebSocketServerHelper.send_connection_ack(ws)
await ws.close()

Expand Down
Loading
Loading