astropy/astropy — pull request #1097 by eteq (2013-05-16 05:25:44+00:00)
Title: Catch timeout socket errors in download_file

This addresses a problem mentioned in #1094, but that has been irregularly appearing on Travis for a while.

Basically, for some reason, once in a while (for no cause I can see), `urllib2.urlopen`, as called in `astropy.utils.data.download_file`, throws a `socket.timeout` exception. It's supposed to instead yield a `urllib2.URLError` which *wraps* the `socket.timeout`, but sometimes this doesn't happen (again, I have no idea why). So this just catches the `socket.timeout` and replaces it with the appropriate `urllib2.URLError`, and hence preventing the test referenced in #1094 from failing in that way.