Skip to content

Commit 0cc4bbd

Browse files
author
SendaoYan
committed
gh-148919: Make test_redirect_no_path independent of proxy environment variables
1 parent 435be06 commit 0cc4bbd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/test/test_urllib2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,12 @@ def test_redirect_fragment(self):
13831383
def test_redirect_no_path(self):
13841384
# Issue 14132: Relative redirect strips original path
13851385

1386+
# Keep this test independent from proxy-related environment settings.
1387+
env = self.enterContext(os_helper.EnvironmentVarGuard())
1388+
for var in ("http_proxy", "https_proxy", "all_proxy", "no_proxy",
1389+
"HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY"):
1390+
env.pop(var, None)
1391+
13861392
# clear _opener global variable
13871393
self.addCleanup(urllib.request.urlcleanup)
13881394

0 commit comments

Comments
 (0)