diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-04-08 22:34:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-08 22:34:02 (GMT) |
commit | eb7e29f2a9d075accc1ab3faf3612ac44f5e2183 (patch) | |
tree | 6d4d31556465bc34e12de0ebc98dd751cb0fc09a /Lib/test/test_ssl.py | |
parent | 58721a903074d28151d008d8990c98fc31d1e798 (diff) | |
download | cpython-eb7e29f2a9d075accc1ab3faf3612ac44f5e2183.zip cpython-eb7e29f2a9d075accc1ab3faf3612ac44f5e2183.tar.gz cpython-eb7e29f2a9d075accc1ab3faf3612ac44f5e2183.tar.bz2 |
bpo-35934: Add socket.create_server() utility function (GH-11784)
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 5571822..4444e94 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -765,9 +765,7 @@ class BasicSocketTests(unittest.TestCase): def test_unknown_channel_binding(self): # should raise ValueError for unknown type - s = socket.socket(socket.AF_INET) - s.bind(('127.0.0.1', 0)) - s.listen() + s = socket.create_server(('127.0.0.1', 0)) c = socket.socket(socket.AF_INET) c.connect(s.getsockname()) with test_wrap_socket(c, do_handshake_on_connect=False) as ss: @@ -1663,11 +1661,8 @@ class SSLErrorTests(unittest.TestCase): ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE - with socket.socket() as s: - s.bind(("127.0.0.1", 0)) - s.listen() - c = socket.socket() - c.connect(s.getsockname()) + with socket.create_server(("127.0.0.1", 0)) as s: + c = socket.create_connection(s.getsockname()) c.setblocking(False) with ctx.wrap_socket(c, False, do_handshake_on_connect=False) as c: with self.assertRaises(ssl.SSLWantReadError) as cm: |