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 @@ -1432,7 +1432,8 @@ def test_proxy(self):
14321432 [tup [0 :2 ] for tup in o .calls ])
14331433
14341434 def test_proxy_no_proxy (self ):
1435- os .environ ['no_proxy' ] = 'python.org'
1435+ env = self .enterContext (os_helper .EnvironmentVarGuard ())
1436+ env ['no_proxy' ] = 'python.org'
14361437 o = OpenerDirector ()
14371438 ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
14381439 o .add_handler (ph )
@@ -1444,18 +1445,17 @@ def test_proxy_no_proxy(self):
14441445 self .assertEqual (req .host , "www.python.org" )
14451446 o .open (req )
14461447 self .assertEqual (req .host , "www.python.org" )
1447- del os .environ ['no_proxy' ]
14481448
14491449 def test_proxy_no_proxy_all (self ):
1450- os .environ ['no_proxy' ] = '*'
1450+ env = self .enterContext (os_helper .EnvironmentVarGuard ())
1451+ env ['no_proxy' ] = '*'
14511452 o = OpenerDirector ()
14521453 ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
14531454 o .add_handler (ph )
14541455 req = Request ("http://www.python.org" )
14551456 self .assertEqual (req .host , "www.python.org" )
14561457 o .open (req )
14571458 self .assertEqual (req .host , "www.python.org" )
1458- del os .environ ['no_proxy' ]
14591459
14601460 def test_proxy_https (self ):
14611461 o = OpenerDirector ()
You can’t perform that action at this time.
0 commit comments