classification
Title: test.test_ftplib.TestIPv6Environment failure
Type: behavior Stage: resolved
Components: Tests Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, haypo, neologix, python-dev
Priority: normal Keywords: patch

Created on 2011-04-29 21:08 by neologix, last changed 2011-04-30 23:24 by haypo. This issue is now closed.

Files
File name Uploaded Description Edit
test_ftplib_ipv6.diff neologix, 2011-04-29 21:08 review
Messages (3)
msg134811 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-04-29 21:08
test_ftplib fails in TestIPv6Environment:

======================================================================
ERROR: test_makepasv (test.test_ftplib.TestIPv6Environment)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cf/cpython/Lib/test/test_ftplib.py", line 651, in setUp
    self.server = DummyFTPServer((HOST, 0), af=socket.AF_INET6)
  File "/home/cf/cpython/Lib/test/test_ftplib.py", line 220, in __init__
    self.bind(address)
  File "/home/cf/cpython/Lib/asyncore.py", line 339, in bind
    return self.socket.bind(addr)
socket.gaierror: [Errno -2] Name or service not known

======================================================================
ERROR: test_transfer (test.test_ftplib.TestIPv6Environment)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cf/cpython/Lib/test/test_ftplib.py", line 651, in setUp
    self.server = DummyFTPServer((HOST, 0), af=socket.AF_INET6)
  File "/home/cf/cpython/Lib/test/test_ftplib.py", line 220, in __init__
    self.bind(address)
  File "/home/cf/cpython/Lib/asyncore.py", line 339, in bind
    return self.socket.bind(addr)
socket.gaierror: [Errno -2] Name or service not known

----------------------------------------------------------------------
Ran 74 tests in 6.595s

FAILED (errors=2)
test test_ftplib failed -- multiple errors occurred
1 test failed:
    test_ftplib

The reason is that support.HOST is 'localhost'. and on most machines, localhost is an alias for 127.0.0.1, and not the IPv6 loopback, so the address resolution fails.
One possible solution is simply to pass ::1 (IPv6 loopback address) instead of support.HOST.
Patch attached.
msg134891 - (view) Author: Roundup Robot (python-dev) Date: 2011-04-30 23:23
New changeset e680564efa8c by Victor Stinner in branch 'default':
Close #11958: Fix FTP tests for IPv6, bind to "::1" instead of "localhost".
http://hg.python.org/cpython/rev/e680564efa8c
msg134892 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2011-04-30 23:24
We may have a support.HOST_IPV6 constant, but I would imply to modify many tests to use it. I prefer to apply your simple patch, thanks!
History
Date User Action Args
2011-04-30 23:24:29hayposetnosy: + haypo
messages: + msg134892
2011-04-30 23:23:07python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg134891

resolution: fixed
stage: resolved
2011-04-29 21:08:01neologixcreate