]> granicus.if.org Git - python/commitdiff
Issue #25138: test_socket.test_idna() uses support.transient_internet() instead
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 21 Sep 2015 07:04:01 +0000 (09:04 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 21 Sep 2015 07:04:01 +0000 (09:04 +0200)
of catching socket.EAI_NODATA error which doesn't exist on FreeBSD.

Lib/test/test_socket.py

index cc8da17609f7fb97799e90ef5ed871082d098ad4..d3191121b58ac8fe8c2dfcb2d314dc6d57b954b8 100644 (file)
@@ -1284,12 +1284,11 @@ class GeneralModuleTests(unittest.TestCase):
     @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)