Skip to content

Commit

Permalink
🔧 try to overcome flaky socket in test_socket_close_stays_open_with_m…
Browse files Browse the repository at this point in the history
…akefile_open
  • Loading branch information
Ousret committed Dec 4, 2024
1 parent e056366 commit 16b5b24
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/with_dummyserver/test_socketlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ def consume_ssl_socket(listener: socket.socket) -> None:
ca_certs=DEFAULT_CA,
) as ssl_sock:
consume_socket(ssl_sock)
except (ConnectionResetError, ConnectionAbortedError, OSError):
except (ConnectionResetError, ConnectionAbortedError, OSError, SSLError):
pass

self._start_server(consume_ssl_socket)
Expand All @@ -1038,9 +1038,13 @@ def consume_ssl_socket(listener: socket.socket) -> None:
ssl_sock.close()
ssl_sock.sendall(b"hello")
assert ssl_sock.fileno() > 0
ssl_sock.sendall(
b"\r\n\r\n"
) # sent to make sure the thread exit (server_start) properly!
for _ in range(6): # CI flakyness?!
try:
ssl_sock.sendall(
b"\r\n\r\n"
) # sent to make sure the thread exit (server_start) properly!
except Exception: # bare except, what we wanted to test already passed.
pass


class TestProxyManager(SocketDummyServerTestCase):
Expand Down

0 comments on commit 16b5b24

Please sign in to comment.