mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
f1464f4d2e
commit
3c7931e514
4 changed files with 21 additions and 16 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue