[Python-checkins] cpython: Use the recent support.HOSTv6 addition.

charles-francois.natali python-checkins at python.org
Sat Aug 31 17:34:51 CEST 2013


http://hg.python.org/cpython/rev/f20201db7592
changeset:   85470:f20201db7592
parent:      85464:8f39e2f987fb
user:        Charles-François Natali <cf.natali at gmail.com>
date:        Sat Aug 31 14:40:49 2013 +0200
summary:
  Use the recent support.HOSTv6 addition.

files:
  Lib/test/support/__init__.py |   2 +-
  Lib/test/test_socket.py      |  10 +++-------
  2 files changed, 4 insertions(+), 8 deletions(-)


diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -587,7 +587,7 @@
         sock = None
         try:
             sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
-            sock.bind(('::1', 0))
+            sock.bind((HOSTv6, 0))
             return True
         except OSError:
             pass
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
@@ -565,11 +565,7 @@
 class Inet6TestBase(InetTestBase):
     """Base class for IPv6 socket tests."""
 
-    # Don't use "localhost" here - it may not have an IPv6 address
-    # assigned to it by default (e.g. in /etc/hosts), and if someone
-    # has assigned it an IPv4-mapped address, then it's unlikely to
-    # work with the full IPv6 API.
-    host = "::1"
+    host = support.HOSTv6
 
 class UDP6TestBase(Inet6TestBase):
     """Base class for UDP-over-IPv6 tests."""
@@ -1321,9 +1317,9 @@
     @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.')
     def test_flowinfo(self):
         self.assertRaises(OverflowError, socket.getnameinfo,
-                          ('::1',0, 0xffffffff), 0)
+                          (support.HOSTv6, 0, 0xffffffff), 0)
         with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s:
-            self.assertRaises(OverflowError, s.bind, ('::1', 0, -10))
+            self.assertRaises(OverflowError, s.bind, (support.HOSTv6, 0, -10))
 
 
 @unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.')

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


More information about the Python-checkins mailing list