Skip to content

Commit fd27c2d

Browse files
authored
Fix SSL handshake partial send (#6635)
* simplify test_ftplib * mark flaky test * better ssl handshake, pending tls output * flush_all_pending * deadline * flush pending
1 parent 8bfe927 commit fd27c2d

File tree

4 files changed

+513
-117
lines changed

4 files changed

+513
-117
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ def _acquire_release(lock, timeout, l=None, n=1):
14591459
for _ in range(n):
14601460
lock.release()
14611461

1462-
@unittest.expectedFailureIf(sys.platform == "darwin", "TODO: RUSTPYTHON")
1462+
@unittest.skipIf(sys.platform == 'darwin', "TODO: RUSTPYTHON; flaky on darwin")
14631463
def test_repr_rlock(self):
14641464
if self.TYPE != 'processes':
14651465
self.skipTest('test not appropriate for {}'.format(self.TYPE))

Lib/test/test_ftplib.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -593,31 +593,24 @@ def test_quit(self):
593593
def test_abort(self):
594594
self.client.abort()
595595

596-
@unittest.skip('TODO: RUSTPYTHON')
597-
# TimeoutError: The read operation timed out
598596
def test_retrbinary(self):
599597
received = []
600598
self.client.retrbinary('retr', received.append)
601599
self.check_data(b''.join(received),
602600
RETR_DATA.encode(self.client.encoding))
603601

604-
@unittest.skip('TODO: RUSTPYTHON')
605-
# TimeoutError: The read operation timed out
606602
def test_retrbinary_rest(self):
607603
for rest in (0, 10, 20):
608604
received = []
609605
self.client.retrbinary('retr', received.append, rest=rest)
610606
self.check_data(b''.join(received),
611607
RETR_DATA[rest:].encode(self.client.encoding))
612608

613-
@unittest.skip('TODO: RUSTPYTHON')
614-
# TimeoutError: The read operation timed out
615609
def test_retrlines(self):
616610
received = []
617611
self.client.retrlines('retr', received.append)
618612
self.check_data(''.join(received), RETR_DATA.replace('\r\n', ''))
619613

620-
@unittest.skip('TODO: RUSTPYTHON; weird limiting to 8192, something w/ buffering?')
621614
def test_storbinary(self):
622615
f = io.BytesIO(RETR_DATA.encode(self.client.encoding))
623616
self.client.storbinary('stor', f)
@@ -629,8 +622,6 @@ def test_storbinary(self):
629622
self.client.storbinary('stor', f, callback=lambda x: flag.append(None))
630623
self.assertTrue(flag)
631624

632-
@unittest.skip('TODO: RUSTPYTHON')
633-
# ssl_error.SSLWantReadError: The operation did not complete (read)
634625
def test_storbinary_rest(self):
635626
data = RETR_DATA.replace('\r\n', '\n').encode(self.client.encoding)
636627
f = io.BytesIO(data)
@@ -639,8 +630,6 @@ def test_storbinary_rest(self):
639630
self.client.storbinary('stor', f, rest=r)
640631
self.assertEqual(self.server.handler_instance.rest, str(r))
641632

642-
@unittest.skip('TODO: RUSTPYTHON')
643-
# ssl_error.SSLWantReadError: The operation did not complete (read)
644633
def test_storlines(self):
645634
data = RETR_DATA.replace('\r\n', '\n').encode(self.client.encoding)
646635
f = io.BytesIO(data)
@@ -658,21 +647,15 @@ def test_storlines(self):
658647
with warnings_helper.check_warnings(('', BytesWarning), quiet=True):
659648
self.assertRaises(TypeError, self.client.storlines, 'stor foo', f)
660649

661-
@unittest.skip('TODO: RUSTPYTHON')
662-
# TimeoutError: The read operation timed out
663650
def test_nlst(self):
664651
self.client.nlst()
665652
self.assertEqual(self.client.nlst(), NLST_DATA.split('\r\n')[:-1])
666653

667-
@unittest.skip('TODO: RUSTPYTHON')
668-
# TimeoutError: The read operation timed out
669654
def test_dir(self):
670655
l = []
671656
self.client.dir(l.append)
672657
self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', ''))
673658

674-
@unittest.skip('TODO: RUSTPYTHON')
675-
# TimeoutError: The read operation timed out
676659
def test_mlsd(self):
677660
list(self.client.mlsd())
678661
list(self.client.mlsd(path='/'))
@@ -859,8 +842,6 @@ def test_storlines_too_long(self):
859842
f = io.BytesIO(b'x' * self.client.maxline * 2)
860843
self.assertRaises(ftplib.Error, self.client.storlines, 'stor', f)
861844

862-
@unittest.skip('TODO: RUSTPYTHON')
863-
# TimeoutError: The read operation timed out
864845
def test_encoding_param(self):
865846
encodings = ['latin-1', 'utf-8']
866847
for encoding in encodings:
@@ -922,6 +903,7 @@ def retr():
922903
retr()
923904

924905

906+
@unittest.skip("TODO: RUSTPYTHON; SSL + asyncore has problem")
925907
@skipUnless(ssl, "SSL not available")
926908
@requires_subprocess()
927909
class TestTLS_FTPClassMixin(TestFTPClass):
@@ -940,7 +922,7 @@ def setUp(self, encoding=DEFAULT_ENCODING):
940922

941923

942924
@skipUnless(ssl, "SSL not available")
943-
@unittest.skip("TODO: RUSTPYTHON; SSL + asyncore has problem on darwin")
925+
@unittest.skip("TODO: RUSTPYTHON; SSL + asyncore has problem")
944926
@requires_subprocess()
945927
class TestTLS_FTPClass(TestCase):
946928
"""Specific TLS_FTP class tests."""
@@ -1025,8 +1007,6 @@ def test_context(self):
10251007
self.assertIs(sock.context, ctx)
10261008
self.assertIsInstance(sock, ssl.SSLSocket)
10271009

1028-
@unittest.skip('TODO: RUSTPYTHON')
1029-
# ssl_error.SSLWantReadError: The operation did not complete (read)
10301010
def test_ccc(self):
10311011
self.assertRaises(ValueError, self.client.ccc)
10321012
self.client.login(secure=True)

0 commit comments

Comments
 (0)