File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1446,7 +1446,8 @@ def test_proxy(self):
14461446 [tup [0 :2 ] for tup in o .calls ])
14471447
14481448 def test_proxy_no_proxy (self ):
1449- os .environ ['no_proxy' ] = 'python.org'
1449+ env = self .enterContext (os_helper .EnvironmentVarGuard ())
1450+ env ['no_proxy' ] = 'python.org'
14501451 o = OpenerDirector ()
14511452 ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
14521453 o .add_handler (ph )
@@ -1458,18 +1459,17 @@ def test_proxy_no_proxy(self):
14581459 self .assertEqual (req .host , "www.python.org" )
14591460 o .open (req )
14601461 self .assertEqual (req .host , "www.python.org" )
1461- del os .environ ['no_proxy' ]
14621462
14631463 def test_proxy_no_proxy_all (self ):
1464- os .environ ['no_proxy' ] = '*'
1464+ env = self .enterContext (os_helper .EnvironmentVarGuard ())
1465+ env ['no_proxy' ] = '*'
14651466 o = OpenerDirector ()
14661467 ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
14671468 o .add_handler (ph )
14681469 req = Request ("http://www.python.org" )
14691470 self .assertEqual (req .host , "www.python.org" )
14701471 o .open (req )
14711472 self .assertEqual (req .host , "www.python.org" )
1472- del os .environ ['no_proxy' ]
14731473
14741474 def test_proxy_https (self ):
14751475 o = OpenerDirector ()
You can’t perform that action at this time.
0 commit comments