summaryrefslogtreecommitdiff
path: root/Lib/test/test_imaplib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r--Lib/test/test_imaplib.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index a060143e1f..aec36af6c5 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -81,14 +81,8 @@ class TestImaplib(unittest.TestCase):
except socket.error:
pass
- expected_errnos = [
- # This is the exception that should be raised.
- errno.ECONNREFUSED,
- ]
- if hasattr(errno, 'EADDRNOTAVAIL'):
- # socket.create_connection() fails randomly with
- # EADDRNOTAVAIL on Travis CI.
- expected_errnos.append(errno.EADDRNOTAVAIL)
+ # This is the exception that should be raised.
+ expected_errnos = support.get_socket_conn_refused_errs()
with self.assertRaises(OSError) as cm:
imaplib.IMAP4()
self.assertIn(cm.exception.errno, expected_errnos)