From 9b116e8b0281410bf3d9bb1d8db6ad020717cd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Sat, 7 Dec 2013 20:27:41 +0100 Subject: [PATCH] Issue #19857: Make sure that test_imaplib reaps server threads even in face of error upon client disconnection. --- Lib/test/test_imaplib.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index bafd62b63d2..2834963484b 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -211,13 +211,12 @@ class BaseThreadedNetworkedTests(unittest.TestCase): @contextmanager def reaped_pair(self, hdlr): - server, thread = self.make_server((support.HOST, 0), hdlr) - client = self.imap_class(*server.server_address) - try: - yield server, client - finally: - client.logout() - self.reap_server(server, thread) + with self.reaped_server(hdlr) as server: + client = self.imap_class(*server.server_address) + try: + yield server, client + finally: + client.logout() @reap_threads def test_connect(self):