summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-28 16:38:34 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-28 16:38:34 (GMT)
commiteba63c4203322af73fd2a926bd20edc495717577 (patch)
treea7078083c2b419b5573cb166259b66207888e17b /Lib
parent6b671b259120e0004f49216d7197c5b0fd84d99c (diff)
downloadcpython-eba63c4203322af73fd2a926bd20edc495717577.zip
cpython-eba63c4203322af73fd2a926bd20edc495717577.tar.gz
cpython-eba63c4203322af73fd2a926bd20edc495717577.tar.bz2
Issue #13895: fix test_ssl hanging under Ubuntu
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_ssl.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index bde4288..1b08f2e 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1078,28 +1078,28 @@ 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")
- s.close()
+ sys.stdout.write(" client: closing connection.\n")
+ s.close()
def try_protocol_combo(server_protocol, client_protocol, expect_success,
certsreqs=None, server_options=0, client_options=0):