diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-04-15 10:34:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 10:34:53 (GMT) |
commit | 3c7931e514faf509a39c218c2c9f55efb434628f (patch) | |
tree | 0c4bdae0b4ecd84d1ea036893ed70747137ee3f6 /Lib/test/test_imaplib.py | |
parent | f1464f4d2ecf9b809ff768c523c5eea1abd31c55 (diff) | |
download | cpython-3c7931e514faf509a39c218c2c9f55efb434628f.zip cpython-3c7931e514faf509a39c218c2c9f55efb434628f.tar.gz cpython-3c7931e514faf509a39c218c2c9f55efb434628f.tar.bz2 |
bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834)
Fix test_imap4_host_default_value() of test_imaplib: catch also
errno.ENETUNREACH error.
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r-- | Lib/test/test_imaplib.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index a060143..aec36af 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) |