Skip to content

Commit

Permalink
Make some handshakes in tests less flaky. (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjni authored Dec 2, 2022
1 parent 8ba3392 commit 8a75898
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import datetime
import gc
import select
import sys
import uuid
from errno import (
Expand Down Expand Up @@ -1297,20 +1298,20 @@ def _handshake_test(self, serverContext, clientContext):
"""
serverSocket, clientSocket = socket_pair()

server = Connection(serverContext, serverSocket)
server.set_accept_state()
with serverSocket, clientSocket:
server = Connection(serverContext, serverSocket)
server.set_accept_state()

client = Connection(clientContext, clientSocket)
client.set_connect_state()
client = Connection(clientContext, clientSocket)
client.set_connect_state()

# Make them talk to each other.
# interact_in_memory(client, server)
for _ in range(3):
for s in [client, server]:
try:
s.do_handshake()
except WantReadError:
pass
# Make them talk to each other.
for _ in range(3):
for s in [client, server]:
try:
s.do_handshake()
except WantReadError:
select.select([client, server], [], [])

def test_set_verify_callback_connection_argument(self):
"""
Expand Down

0 comments on commit 8a75898

Please sign in to comment.