requests
requests copied to clipboard
Allow tests to run if HTTP proxy env variables are already present,
Hello,
The following tests fail if HTTP proxy environment variables are already set:
FAILED tests/test_requests.py::TestRequests::test_mixed_case_scheme_acceptable
FAILED tests/test_requests.py::TestRequests::test_HTTP_302_ALLOW_REDIRECT_GET
FAILED tests/test_requests.py::TestRequests::test_errors[http://doesnotexist.google.com-ConnectionError]
FAILED tests/test_requests.py::TestRequests::test_respect_proxy_env_on_send_self_prepared_request
FAILED tests/test_requests.py::TestRequests::test_respect_proxy_env_on_send_session_prepared_request
FAILED tests/test_requests.py::TestRequests::test_respect_proxy_env_on_send_with_redirects
FAILED tests/test_requests.py::TestRequests::test_respect_proxy_env_on_get - ...
FAILED tests/test_requests.py::TestRequests::test_respect_proxy_env_on_request
The variables affecting the tests are:
-
http_proxy(andhttps_proxypotentially) -
no_proxy
Fixed by overriding their value if they are already present in the environment.
The override_environ function would fail if attempting to delete a variable that is not in the environment. Added a suppress(KeyError) construct around the del instruction to fix it.
Thanks, Oilvier