diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 84ec429133562e..41eac2396bb410 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4533,6 +4533,10 @@ def test_create_connection(self): 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) self.assertIn(cm.exception.errno, expected_errnos)