bpo-43921: Fix test_ssl.test_wrong_cert_tls13() on Windows (GH-26502) · python/cpython@ea0210f

@@ -3190,7 +3190,8 @@ def test_wrong_cert_tls13(self):

31903190

)

31913191

with server, \

31923192

client_context.wrap_socket(socket.socket(),

3193-

server_hostname=hostname) as s:

3193+

server_hostname=hostname,

3194+

suppress_ragged_eofs=False) as s:

31943195

# TLS 1.3 perform client cert exchange after handshake

31953196

s.connect((HOST, server.port))

31963197

try:

@@ -3207,13 +3208,7 @@ def test_wrong_cert_tls13(self):

32073208

if support.verbose:

32083209

sys.stdout.write("\nsocket.error is %r\n" % e)

32093210

else:

3210-

if sys.platform == "win32":

3211-

self.skipTest(

3212-

"Ignoring failed test_wrong_cert_tls13 test case. "

3213-

"The test is flaky on Windows, see bpo-43921."

3214-

)

3215-

else:

3216-

self.fail("Use of invalid cert should have failed!")

3211+

self.fail("Use of invalid cert should have failed!")

3217321232183213

def test_rude_shutdown(self):

32193214

"""A brutal shutdown of an SSL server should raise an OSError

@@ -4450,7 +4445,8 @@ def msg_cb(conn, direction, version, content_type, msg_type, data):

44504445

server = ThreadedEchoServer(context=server_context, chatty=True)

44514446

with server:

44524447

with client_context.wrap_socket(socket.socket(),

4453-

server_hostname=hostname) as s:

4448+

server_hostname=hostname,

4449+

suppress_ragged_eofs=False) as s:

44544450

s.connect((HOST, server.port))

44554451

s.write(b'PHA')

44564452

# test sometimes fails with EOF error. Test passes as long as

@@ -4461,17 +4457,13 @@ def msg_cb(conn, direction, version, content_type, msg_type, data):

44614457

):

44624458

# receive CertificateRequest

44634459

data = s.recv(1024)

4464-

if not data:

4465-

raise ssl.SSLError(1, "EOF occurred")

44664460

self.assertEqual(data, b'OK\n')

4467446144684462

# send empty Certificate + Finish

44694463

s.write(b'HASCERT')

4470446444714465

# receive alert

4472-

data = s.recv(1024)

4473-

if not data:

4474-

raise ssl.SSLError(1, "EOF occurred")

4466+

s.recv(1024)

4475446744764468

def test_pha_optional(self):

44774469

if support.verbose: