Skip to content
Merged
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
16 changes: 13 additions & 3 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
SOL_SOCKET,
gaierror,
socket,
socketpair,
)
from sys import getfilesystemencoding, platform
from weakref import ref
Expand Down Expand Up @@ -670,7 +671,8 @@ def test_load_client_ca_unicode(
"""
Passing the path as unicode raises a warning but works.
"""
pytest.deprecated_call(context.load_client_ca, ca_file.decode("ascii"))
with pytest.deprecated_call():
context.load_client_ca(ca_file.decode("ascii")) # type: ignore[arg-type]

def test_set_session_id(self, context: Context) -> None:
"""
Expand Down Expand Up @@ -705,7 +707,8 @@ def test_set_session_id_unicode(self, context: Context) -> None:
`Context.set_session_id` raises a warning if a unicode string is
passed.
"""
pytest.deprecated_call(context.set_session_id, "abc")
with pytest.deprecated_call():
context.set_session_id("abc") # type: ignore[arg-type]

def test_method(self) -> None:
"""
Expand Down Expand Up @@ -3070,7 +3073,14 @@ def test_wantWriteError(self) -> None:
`OpenSSL.SSL.WantWriteError` if writing to the connection's BIO
fail indicating a should-write state.
"""
client_socket, _ = socket_pair()
# Use Unix domain sockets rather than TCP loopback. On macOS,
# TCP loopback aggressively auto-tunes buffer sizes and drains
# the send buffer into the peer's receive buffer nearly
# instantly, so the send buffer won't stay full long enough
# for do_handshake() to observe it.
client_socket, peer = socketpair()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This defaults to AF_UNIX on macOS and Linux. Do I even want to know what it does on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AF_INET

client_socket.setblocking(False)
peer.setblocking(False)
# Fill up the client's send buffer so Connection won't be able to write
# anything. Start by sending larger chunks (Windows Socket I/O is slow)
# and continue by writing a single byte at a time so we can be sure we
Expand Down