summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-12-07 20:30:17 +0100
committerCharles-François Natali <cf.natali@gmail.com>2013-12-07 20:30:17 +0100
commit6c527cf37f9ca6249f523ef3a59e27e64cc13e87 (patch)
treeb6b289b85687301bf9900220f15ca9e6f547b5db /Lib
parent933142a8f238529c610edf2100c4208a8ee82805 (diff)
downloadcpython-git-6c527cf37f9ca6249f523ef3a59e27e64cc13e87.tar.gz
Issue #19857: Make sure that test_imaplib reaps server threads even in face of
error upon client disconnection.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_imaplib.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index daa8afeec5..7c9afd9f39 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -210,13 +210,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):