[Python-checkins] cpython: Close #11958: Fix FTP tests for IPv6, bind to "::1" instead of "localhost".

victor.stinner python-checkins at python.org
Sun May 1 01:23:06 CEST 2011


http://hg.python.org/cpython/rev/e680564efa8c
changeset:   69731:e680564efa8c
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Sun May 01 01:23:03 2011 +0200
summary:
  Close #11958: Fix FTP tests for IPv6, bind to "::1" instead of "localhost".
Patch written by Charles-Francois Natali.

files:
  Lib/test/test_ftplib.py |  9 ++-------
  Misc/NEWS               |  3 +++
  2 files changed, 5 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -648,7 +648,7 @@
 class TestIPv6Environment(TestCase):
 
     def setUp(self):
-        self.server = DummyFTPServer((HOST, 0), af=socket.AF_INET6)
+        self.server = DummyFTPServer(('::1', 0), af=socket.AF_INET6)
         self.server.start()
         self.client = ftplib.FTP()
         self.client.connect(self.server.host, self.server.port)
@@ -874,12 +874,7 @@
 def test_main():
     tests = [TestFTPClass, TestTimeouts]
     if support.IPV6_ENABLED:
-        try:
-            DummyFTPServer((HOST, 0), af=socket.AF_INET6)
-        except socket.error:
-            pass
-        else:
-            tests.append(TestIPv6Environment)
+        tests.append(TestIPv6Environment)
 
     if ssl is not None:
         tests.extend([TestTLS_FTPClassMixin, TestTLS_FTPClass])
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -534,6 +534,9 @@
 Tests
 -----
 
+- Issue #11958: Fix FTP tests for IPv6, bind to "::1" instead of "localhost".
+  Patch written by Charles-Francois Natali.
+
 - Issue #8407, #11859: Fix tests of test_io using threads and an alarm: use
   pthread_sigmask() to ensure that the SIGALRM signal is received by the main
   thread.

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


More information about the Python-checkins mailing list