[Python-checkins] Fix test_socket.test_create_connection() (GH-4206) (#4209)

Victor Stinner webhook-mailer at python.org
Wed Nov 1 09:08:43 EDT 2017


https://github.com/python/cpython/commit/4b73a79e796c3832be0cfd45bc27f15aea32b621
commit: 4b73a79e796c3832be0cfd45bc27f15aea32b621
branch: 2.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Victor Stinner <victor.stinner at gmail.com>
date: 2017-11-01T06:08:40-07:00
summary:

Fix test_socket.test_create_connection() (GH-4206) (#4209)

bpo-31910: test_create_connection() now catchs also EADDRNOTAVAIL to
fix the test on Travis CI.
(cherry picked from commit 280c22a82a6756e9caffef031c564fd98f1b50e7)

files:
M Lib/test/test_socket.py

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index bef18728226..1126fc2b77b 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1358,6 +1358,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)
 



More information about the Python-checkins mailing list