Skip to content

Commit 7352864

Browse files
authored
bpo-30818: test_ftplib calls asyncore.close_all() (#2514)
Always clear asyncore socket map using asyncore.close_all(ignore_all=True) in tearDown() method. This change should fix this warning: Warning -- asyncore.socket_map was modified by test_ftplib Before: {} After: {4: <test.test_ftplib.DummyTLS_FTPServer 127.0.0.1:0 at 0x805feccf0>}
1 parent 45dba3a commit 7352864

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/test/test_ftplib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ def setUp(self):
470470
def tearDown(self):
471471
self.client.close()
472472
self.server.stop()
473+
asyncore.close_all(ignore_all=True)
473474

474475
def check_data(self, received, expected):
475476
self.assertEqual(len(received), len(expected))
@@ -795,6 +796,7 @@ def setUp(self):
795796
def tearDown(self):
796797
self.client.close()
797798
self.server.stop()
799+
asyncore.close_all(ignore_all=True)
798800

799801
def test_af(self):
800802
self.assertEqual(self.client.af, socket.AF_INET6)
@@ -853,6 +855,7 @@ def setUp(self):
853855
def tearDown(self):
854856
self.client.close()
855857
self.server.stop()
858+
asyncore.close_all(ignore_all=True)
856859

857860
def test_control_connection(self):
858861
self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)

0 commit comments

Comments
 (0)