urllib2 test fails (2.7, linux)

guandalino guandalino at gmail.com
Tue Jul 20 07:42:58 EDT 2010


Hi, running Python 2.7 test suite for urllib2 there is a test that
doesn't pass.
Do you have an idea about where the problem could be and how to solve
it?

Thanks,
best regards.

$ # ubuntu 8.04
$ pwd
~/sandbox/2.7/lib/python2.7/test
$ python test_urllib2.py
======================================================================
ERROR: test_file (__main__.HandlerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_urllib2.py", line 711, in test_file
    h.file_open, Request(url))
  File "/home/redt/sandbox/2.7/lib/python2.7/unittest/case.py", line
456, in assertRaises
    callableObj(*args, **kwargs)
  File "/home/redt/sandbox/2.7/lib/python2.7/urllib2.py", line 1269,
in file_open
    return self.open_local_file(req)
  File "/home/redt/sandbox/2.7/lib/python2.7/urllib2.py", line 1301,
in open_local_file
    (not port and socket.gethostbyname(host) in self.get_names()):
gaierror: [Errno -5] No address associated with hostname


Notes:
$ hostname
speedy

$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain speedy

::1 localhost speedy ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Finally, I don't know if this matters but the tests have been executed
offline
(without an internet connection).



More information about the Python-list mailing list