diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-04-15 10:49:37 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-04-15 10:49:37 (GMT) |
commit | 28ed39e83e4c545fa1da89fd7691cace280296f7 (patch) | |
tree | 876f9f4c2ee35ad8c399200971bc9b24e6a98446 /Lib/test/test_socket.py | |
parent | 9f9e029bd2223ecba46eaefecadf0ac252d891f2 (diff) | |
download | cpython-28ed39e83e4c545fa1da89fd7691cace280296f7.zip cpython-28ed39e83e4c545fa1da89fd7691cace280296f7.tar.gz cpython-28ed39e83e4c545fa1da89fd7691cace280296f7.tar.bz2 |
bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834) (GH-12835)
Fix test_imap4_host_default_value() of test_imaplib: catch also
errno.ENETUNREACH error.
(cherry picked from commit 3c7931e514faf509a39c218c2c9f55efb434628f)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 3819652..43929b3 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4720,14 +4720,7 @@ class NetworkConnectionNoServer(unittest.TestCase): # On Solaris, ENETUNREACH is returned in this circumstance instead # of ECONNREFUSED. So, if that errno exists, add it to our list of # expected errnos. - expected_errnos = [ errno.ECONNREFUSED, ] - if hasattr(errno, 'ENETUNREACH'): - expected_errnos.append(errno.ENETUNREACH) - if hasattr(errno, 'EADDRNOTAVAIL'): - # bpo-31910: socket.create_connection() fails randomly - # with EADDRNOTAVAIL on Travis CI - expected_errnos.append(errno.EADDRNOTAVAIL) - + expected_errnos = support.get_socket_conn_refused_errs() self.assertIn(cm.exception.errno, expected_errnos) def test_create_connection_timeout(self): |