This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author guandalino
Recipients benjamin.peterson, ezio.melotti, guandalino, orsenthil, terry.reedy
Date 2010-08-01.10:30:08
SpamBayes Score 8.75603e-05
Marked as misclassified No
Message-id <1280658613.57.0.546595644566.issue9446@psf.upfronthosting.co.za>
In-reply-to
Content
urllib2 tests fail when internet connection is not available.

$ cd ~/sandbox/2.7/lib/python2.7/test
$ python test_urllib2.py

other output, [cut]

======================================================================
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

----------------------------------------------------------------------
Ran 34 tests in 0.414s

FAILED (errors=1)

The issue verifies using ubuntu 8.04 LTS having this /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 

Note that when connected to internet all the tests pass.

Further details can be found in a thread I started 
on comp.lang.python. http://bit.ly/9x9Umu.

I can't guarantee a quick answer but let me know if other info are required, I'll be glad to provide them asap. Thank you.
History
Date User Action Args
2010-08-01 10:30:13guandalinosetrecipients: + guandalino, terry.reedy, orsenthil, benjamin.peterson, ezio.melotti
2010-08-01 10:30:13guandalinosetmessageid: <1280658613.57.0.546595644566.issue9446@psf.upfronthosting.co.za>
2010-08-01 10:30:10guandalinolinkissue9446 messages
2010-08-01 10:30:08guandalinocreate