Skip to content

Commit

Permalink
fix: use ssl.SSLContext.wrap_socket for wrapping socket
Browse files Browse the repository at this point in the history
* ssl.wrap_socket() was marked as deprecated in Python 3.7
  * It stopped to work in Python 3.12
* We use it only for unit tests
  • Loading branch information
jirihnidek committed Jan 19, 2024
1 parent 2ffc96b commit 7896f0f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/complex/fake_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def __init__(self, queue, port=None, code=None, host='localhost'):
raise OSError("No such file %s" % certfile)
if not os.access(keyfile, os.R_OK):
raise OSError("No such file %s" % keyfile)
self.server.socket = ssl.wrap_socket(self.server.socket, certfile=certfile, keyfile=keyfile, server_side=True)
ssl_ctx = ssl.create_default_context()
ssl_ctx.load_cert_chain(certfile=certfile, keyfile=keyfile)
ssl_ctx.check_hostname = False
self.server.socket = ssl_ctx.wrap_socket(self.server.socket, server_side=True)

self.tempdir = tempfile.mkdtemp()
config_name = os.path.join(self.tempdir, 'rhsm.conf')
Expand Down

0 comments on commit 7896f0f

Please sign in to comment.