summaryrefslogtreecommitdiffstats
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.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index f16bacd..a0b598d 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -1,6 +1,7 @@
from test import support
from contextlib import contextmanager
+import errno
import imaplib
import os.path
import socketserver
@@ -69,6 +70,19 @@ class TestImaplib(unittest.TestCase):
for t in self.timevalues():
imaplib.Time2Internaldate(t)
+ def test_imap4_host_default_value(self):
+ 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)
+ with self.assertRaises(OSError) as cm:
+ imaplib.IMAP4()
+ self.assertIn(cm.exception.errno, expected_errnos)
+
if ssl:
class SecureTCPServer(socketserver.TCPServer):