[Python-checkins] cpython (3.4): Issue #25138: test_socket.test_idna() uses support.transient_internet() instead

victor.stinner python-checkins at python.org
Mon Sep 21 09:09:02 CEST 2015


https://hg.python.org/cpython/rev/f13a5b5a2824
changeset:   98128:f13a5b5a2824
branch:      3.4
parent:      98125:084a8813f05f
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Sep 21 09:04:01 2015 +0200
summary:
  Issue #25138: test_socket.test_idna() uses support.transient_internet() instead
of catching socket.EAI_NODATA error which doesn't exist on FreeBSD.

files:
  Lib/test/test_socket.py |  9 ++++-----
  1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1284,12 +1284,11 @@
     @unittest.skipUnless(support.is_resource_enabled('network'),
                          'network is not enabled')
     def test_idna(self):
-        # Check for internet access before running test (issue #12804).
-        try:
+        # Check for internet access before running test
+        # (issue #12804, issue #25138).
+        with support.transient_internet('python.org'):
             socket.gethostbyname('python.org')
-        except socket.gaierror as e:
-            if e.errno == socket.EAI_NODATA:
-                self.skipTest('internet access required for this test')
+
         # these should all be successful
         domain = 'испытание.pythontest.net'
         socket.gethostbyname(domain)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list