diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-28 16:40:23 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-28 16:40:23 (GMT) |
commit | ce816a51112afb28d1a7ea7e2e10af749be9ff28 (patch) | |
tree | fefe03b4f059a39a8f5e801f21f3d3e2a323adb1 | |
parent | d770fe45a08a02f4364748ca0582b2c11a3bb4a5 (diff) | |
parent | eba63c4203322af73fd2a926bd20edc495717577 (diff) | |
download | cpython-ce816a51112afb28d1a7ea7e2e10af749be9ff28.zip cpython-ce816a51112afb28d1a7ea7e2e10af749be9ff28.tar.gz cpython-ce816a51112afb28d1a7ea7e2e10af749be9ff28.tar.bz2 |
Issue #13895: fix test_ssl hanging under Ubuntu
-rw-r--r-- | Lib/test/test_ssl.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 6439441..33f06d6 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1198,33 +1198,33 @@ else: chatty=chatty, connectionchatty=False) with server: - s = client_context.wrap_socket(socket.socket()) - s.connect((HOST, server.port)) - for arg in [indata, bytearray(indata), memoryview(indata)]: - if connectionchatty: - if support.verbose: - sys.stdout.write( - " client: sending %r...\n" % indata) - s.write(arg) - outdata = s.read() + with client_context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + for arg in [indata, bytearray(indata), memoryview(indata)]: + if connectionchatty: + if support.verbose: + sys.stdout.write( + " client: sending %r...\n" % indata) + s.write(arg) + outdata = s.read() + if connectionchatty: + if support.verbose: + sys.stdout.write(" client: read %r\n" % outdata) + if outdata != indata.lower(): + raise AssertionError( + "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" + % (outdata[:20], len(outdata), + indata[:20].lower(), len(indata))) + s.write(b"over\n") if connectionchatty: if support.verbose: - sys.stdout.write(" client: read %r\n" % outdata) - if outdata != indata.lower(): - raise AssertionError( - "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" - % (outdata[:20], len(outdata), - indata[:20].lower(), len(indata))) - s.write(b"over\n") - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: closing connection.\n") - stats = { - 'compression': s.compression(), - 'cipher': s.cipher(), - } - s.close() - return stats + sys.stdout.write(" client: closing connection.\n") + stats = { + 'compression': s.compression(), + 'cipher': s.cipher(), + } + s.close() + return stats def try_protocol_combo(server_protocol, client_protocol, expect_success, certsreqs=None, server_options=0, client_options=0): |