]> granicus.if.org Git - python/commitdiff
Close #11958: Fix FTP tests for IPv6, bind to "::1" instead of "localhost".
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 30 Apr 2011 23:23:03 +0000 (01:23 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 30 Apr 2011 23:23:03 +0000 (01:23 +0200)
Patch written by Charles-Francois Natali.

Lib/test/test_ftplib.py
Misc/NEWS

index cfdfa2c131ea5b25012d6a0eee21996aba10ec0e..6dbe2b6edc50559aa3e4917a68e2f680d7598752 100644 (file)
@@ -648,7 +648,7 @@ class TestFTPClass(TestCase):
 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 @@ class TestTimeouts(TestCase):
 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])
index 1230a680c3c41a44e14e36d477e50baa403a8859..1e31c8f9d69efeb553a780922a33b858c16b741f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -534,6 +534,9 @@ Extensions
 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.