cloud-init/tools/noproxy
Scott Moser e708c300aa tox: disable proxies when running nosetests
httpretty does not handle proxy well, but the need for http_proxy and
https_proxy is present if you're needing to install pip packages
behind a proxy.

Right now this will fail:
  http_proxy=http://my.proxy/ tox --recreate

Example failures are in
   UrlHelperWaitForUrlsTest.test_url_wait_for

it seems reasonable that we would never want proxy set when running tests
as we should never be doing real http traffic.

This just wraps our calls to nosetests with something that removes
the http_proxy friends.

Change-Id: I96585acaed0c8d70e1925b3859c85c87d1e07b2f
2015-06-25 09:54:55 -04:00

13 lines
355 B
Python

#!/usr/bin/env python
#
# clean http_proxy variables from environment as they make httpretty
# fail, but may be in the environment for reasons such as pip install
import os
import sys
for k in ('http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY'):
if k in os.environ:
del os.environ[k]
os.execvpe(sys.argv[1], sys.argv[1:], os.environ)