summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imaplib.py
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-12-07 19:27:41 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2013-12-07 19:27:41 (GMT)
commit9b116e8b0281410bf3d9bb1d8db6ad020717cd09 (patch)
tree130d59eaf94de3d80048aacd19a56b2f212bd174 /Lib/test/test_imaplib.py
parent2e7d4f0cbf4b976aedbf91794f3da9ea25de17fb (diff)
downloadcpython-9b116e8b0281410bf3d9bb1d8db6ad020717cd09.zip
cpython-9b116e8b0281410bf3d9bb1d8db6ad020717cd09.tar.gz
cpython-9b116e8b0281410bf3d9bb1d8db6ad020717cd09.tar.bz2
Issue #19857: Make sure that test_imaplib reaps server threads even in face of
error upon client disconnection.
Diffstat (limited to 'Lib/test/test_imaplib.py')
-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 bafd62b..2834963 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):