Skip to content

Commit 23b4cc5

Browse files
author
Paul Monson
committed
fix test_pha_required_nocert test for windows
1 parent c3dd8fe commit 23b4cc5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/test/test_ssl.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,9 +2345,12 @@ def run(self):
23452345
self.close()
23462346
self.running = False
23472347
except OSError as err:
2348-
if 'peer did not return a certificate' in err.args[1] and self.server.chatty:
2348+
if 'peer did not return a certificate' in err.args[1]:
23492349
# test_pha_required_nocert causes this error which results in a false(?) failure
2350-
sys.stdout.write(err.args[1])
2350+
if self.server.chatty and support.verbose:
2351+
sys.stdout.write(err.args[1])
2352+
# test_pha_required_nocert is expecting this exception
2353+
raise ssl.SSLError('tlsv13 alert certificate required')
23512354
else:
23522355
if self.server.chatty:
23532356
handle_error("Test server failure:\n")
@@ -4286,7 +4289,7 @@ def test_pha_required_nocert(self):
42864289
server_context.verify_mode = ssl.CERT_REQUIRED
42874290
client_context.post_handshake_auth = True
42884291

4289-
server = ThreadedEchoServer(context=server_context, chatty=True)
4292+
server = ThreadedEchoServer(context=server_context, chatty=False)
42904293
with server:
42914294
with client_context.wrap_socket(socket.socket(),
42924295
server_hostname=hostname) as s:

0 commit comments

Comments
 (0)