Skip to content

Commit

Permalink
Python 3.12 ssl no longer has the ssl.wrap_socket method causes `ha…
Browse files Browse the repository at this point in the history
…zelcast_cloud_discovery_test` failure [API-2195] (#656)

* Python 3.12 ssl no longer has the ssl.wrap_socket method but it is replaced with the ssl_context usage. The tests fail at 3.12 build without this fix.
  • Loading branch information
ihsandemir authored Jan 4, 2024
1 parent f32c630 commit cbaf955
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/unit/discovery/hazelcast_cloud_discovery_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ class Server:

def __init__(self):
self.server = HTTPServer((HOST, 0), CloudHTTPHandler)
self.server.socket = ssl.wrap_socket(
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ssl_context.load_cert_chain(
get_abs_path(self.cur_dir, "cert.pem"), get_abs_path(self.cur_dir, "key.pem")
)
self.server.socket = ssl_context.wrap_socket(
self.server.socket,
get_abs_path(self.cur_dir, "key.pem"),
get_abs_path(self.cur_dir, "cert.pem"),
server_side=True,
)
self.port = self.server.socket.getsockname()[1]
Expand Down

0 comments on commit cbaf955

Please sign in to comment.