summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ftplib.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-13 22:56:14 (GMT)
committerGitHub <noreply@github.com>2017-09-13 22:56:14 (GMT)
commitef323e8d82b07d4e7e4303c360dc32d3de0b3147 (patch)
treed0da0d030f990dfe05315d48e44a092d0b27747f /Lib/test/test_ftplib.py
parentd99e85b9f6422dd5e4f2eb1539368fc4003d4c8b (diff)
downloadcpython-ef323e8d82b07d4e7e4303c360dc32d3de0b3147.zip
cpython-ef323e8d82b07d4e7e4303c360dc32d3de0b3147.tar.gz
cpython-ef323e8d82b07d4e7e4303c360dc32d3de0b3147.tar.bz2
[3.6] bpo-31234: Fix dangling thread in test_ftp/poplib (#3554)
* bpo-31234: Fix dangling thread in test_ftp/poplib (#3540) Explicitly clear the server attribute in test_ftplib and test_poplib to prevent dangling thread. (cherry picked from commit d403a29c0055de6b03ed5ae7a5c564e1c95a5950) * bpo-31234: Fix dangling thread in test_ftplib (#3544) Clear also self.server_thread attribute in TestTimeouts.tearDown(). (cherry picked from commit b157ce1e58b03988ce4340a55d0b856125833cc5)
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index a561e9e..b593313 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -470,6 +470,9 @@ class TestFTPClass(TestCase):
def tearDown(self):
self.client.close()
self.server.stop()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server = None
+ asyncore.close_all(ignore_all=True)
def check_data(self, received, expected):
self.assertEqual(len(received), len(expected))
@@ -799,6 +802,9 @@ class TestIPv6Environment(TestCase):
def tearDown(self):
self.client.close()
self.server.stop()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server = None
+ asyncore.close_all(ignore_all=True)
def test_af(self):
self.assertEqual(self.client.af, socket.AF_INET6)
@@ -857,6 +863,9 @@ class TestTLS_FTPClass(TestCase):
def tearDown(self):
self.client.close()
self.server.stop()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server = None
+ asyncore.close_all(ignore_all=True)
def test_control_connection(self):
self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
@@ -979,6 +988,8 @@ class TestTimeouts(TestCase):
def tearDown(self):
ftplib.FTP.port = self.old_port
self.server_thread.join()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server_thread = None
def server(self):
# This method sets the evt 3 times: