astropy/astropy — pull request #2318 by embray (2014-05-08 19:56:37+00:00)
Title: IOError from unit tests in disable_internet.py in localhost check

On a Linux Server at work when I run the Astropy unit tests I get
```
args = (('www-cache.mpi-hd.mpg.de', 3128), 3.0, None), kwargs = {}, host = 'www-cache.mpi-hd.mpg.de', valid_hosts = ('localhost', '127.0.0.1'), h = '127.0.0.1'

def new_function(*args, **kwargs):
if isinstance(args[0], socket.socket):
host = args[1][0]
valid_hosts = ('localhost', '127.0.0.1', '::1')
else:
host = args[0][0]
valid_hosts = ('localhost', '127.0.0.1')
if any([h in host for h in valid_hosts]):
return original_function(*args, **kwargs)
else:
> raise IOError("An attempt was made to connect to the internet "
"by a test that was not marked `remote_data`.")
E IOError: An attempt was made to connect to the internet by a test that was not marked `remote_data`.

astropy/tests/disable_internet.py:28: IOError
```

This occurs in two places:
* `test_localconnect_succeeds` in `astropy/tests/tests/test_socketblocker.py:51`
* `TestWebProfile.test_web_profile` in `astropy/vo/samp/tests/test_web_profile.py:77`

Full output here: https://gist.github.com/cdeil/10577755

For some reason the institute HTTP proxy (`www-cache.mpi-hd.mpg.de`) is passed as `host` on this machine instead of `localhost` or `127.0.0.1`.

@astrofrog @keflavich What's the right fix here? Should I mark the tests as `remote_data` or do I need to set some HTTP configuration or do you want to rewrite the check in `disable_internet.py` somehow?