From 924cbea46730a937c082e10512e7583a493e70af Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 23 Mar 2011 03:10:14 +0100 Subject: [PATCH] Use transient_internet() consistently in test_imaplib --- Lib/test/test_imaplib.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 4ece1bf7414..80340004d79 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -219,20 +219,23 @@ class RemoteIMAPTest(unittest.TestCase): def tearDown(self): if self.server is not None: - self.server.logout() + with transient_internet(self.host): + self.server.logout() def test_logincapa(self): - for cap in self.server.capabilities: - self.assertIsInstance(cap, str) - self.assertTrue('LOGINDISABLED' in self.server.capabilities) - self.assertTrue('AUTH=ANONYMOUS' in self.server.capabilities) - rs = self.server.login(self.username, self.password) - self.assertEqual(rs[0], 'OK') + with transient_internet(self.host): + for cap in self.server.capabilities: + self.assertIsInstance(cap, str) + self.assertTrue('LOGINDISABLED' in self.server.capabilities) + self.assertTrue('AUTH=ANONYMOUS' in self.server.capabilities) + rs = self.server.login(self.username, self.password) + self.assertEqual(rs[0], 'OK') def test_logout(self): - rs = self.server.logout() - self.server = None - self.assertEqual(rs[0], 'BYE') + with transient_internet(self.host): + rs = self.server.logout() + self.server = None + self.assertEqual(rs[0], 'BYE') @unittest.skipUnless(ssl, "SSL not available") @@ -240,8 +243,9 @@ class RemoteIMAP_STARTTLSTest(RemoteIMAPTest): def setUp(self): super().setUp() - rs = self.server.starttls() - self.assertEqual(rs[0], 'OK') + with transient_internet(self.host): + rs = self.server.starttls() + self.assertEqual(rs[0], 'OK') def test_logincapa(self): for cap in self.server.capabilities: