diff --git a/tools/noproxy b/tools/noproxy new file mode 100644 index 00000000..d371e63c --- /dev/null +++ b/tools/noproxy @@ -0,0 +1,12 @@ +#!/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) diff --git a/tox.ini b/tox.ini index 5d6e861f..9621c452 100644 --- a/tox.ini +++ b/tox.ini @@ -13,13 +13,13 @@ setenv = VIRTUAL_ENV={envdir} LC_ALL = en_US.utf-8 deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt -commands = nosetests {posargs} +commands = {envpython} {toxinidir}/tools/noproxy nosetests {posargs} [testenv:py27-coverage] -commands = nosetests --with-coverage --cover-erase --cover-package=cloudinit --cover-min-percentage=90 --cover-html {posargs} +commands = {envpython} {toxinidir}/tools/noproxy nosetests --with-coverage --cover-erase --cover-package=cloudinit --cover-min-percentage=90 --cover-html {posargs} [testenv:py34-coverage] -commands = nosetests --with-coverage --cover-erase --cover-package=cloudinit --cover-min-percentage=90 --cover-html {posargs} +commands = {envpython} {toxinidir}/tools/noproxy nosetests --with-coverage --cover-erase --cover-package=cloudinit --cover-min-percentage=90 --cover-html {posargs} [testenv:pep8] commands = flake8 {posargs}