Issue #19857: Make sure that test_imaplib reaps server threads even in face of

error upon client disconnection.
This commit is contained in:
Charles-François Natali 2013-12-07 20:27:41 +01:00
parent 2e7d4f0cbf
commit 9b116e8b02
1 changed files with 6 additions and 7 deletions

View File

@ -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):