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_socket.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_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 b0bdb11..815f9ad 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4804,14 +4804,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): |