diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index d2fd111f6d9de02..23cbb3c624b28c5 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1412,6 +1412,12 @@ def test_redirect_fragment(self): def test_redirect_no_path(self): # Issue 14132: Relative redirect strips original path + # Keep this test independent from proxy-related environment settings. + env = self.enterContext(os_helper.EnvironmentVarGuard()) + for var in ("http_proxy", "https_proxy", "all_proxy", "no_proxy", + "HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY"): + env.pop(var, None) + # clear _opener global variable self.addCleanup(urllib.request.urlcleanup)