Skip to content

Commit 6bd4132

Browse files
julianz-webknjaz
andauthored
Update tests/test_ssl.py
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
1 parent 069f96f commit 6bd4132

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/test_ssl.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,12 +3209,14 @@ def _shutdown_connections(
32093209
) -> None:
32103210
"""Helper to safely shut down SSL connections and close sockets."""
32113211
logger.debug("--- Cleanup: Shutting down connections ---")
3212-
try:
3213-
if client:
3212+
if client:
3213+
with contextlib.suppress(OpenSSL.SSL.Error):
3214+
# When closing connections in the test teardown stage, we don't care
3215+
# about possible TLS-level problems as the test was specifically
3216+
# emulating corner case situations pre-shutdown. We just attempt
3217+
# releasing resources if possible and disregard any possibly related
3218+
# problems that may occur at this point.
32143219
client.shutdown()
3215-
except Exception:
3216-
# An exception is usually thrown so it is caught and ignored.
3217-
pass
32183220
try:
32193221
if server:
32203222
server.shutdown()

0 commit comments

Comments
 (0)