[Python-checkins] cpython: Issue #19857: Make sure that test_imaplib reaps server threads even in face of

charles-francois.natali python-checkins at python.org
Sat Dec 7 20:53:39 CET 2013


http://hg.python.org/cpython/rev/6c81df506739
changeset:   87811:6c81df506739
parent:      87809:4e9fb4ce7cf9
user:        Charles-François Natali <cf.natali at gmail.com>
date:        Sat Dec 07 20:27:41 2013 +0100
summary:
  Issue #19857: Make sure that test_imaplib reaps server threads even in face of
error upon client disconnection.

files:
  Lib/test/test_imaplib.py |  13 ++++++-------
  1 files changed, 6 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -211,13 +211,12 @@
 
     @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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list