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):
1446
1446
[tup [0 :2 ] for tup in o .calls ])
1447
1447
1448
1448
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'
1450
1451
o = OpenerDirector ()
1451
1452
ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
1452
1453
o .add_handler (ph )
@@ -1458,18 +1459,17 @@ def test_proxy_no_proxy(self):
1458
1459
self .assertEqual (req .host , "www.python.org" )
1459
1460
o .open (req )
1460
1461
self .assertEqual (req .host , "www.python.org" )
1461
- del os .environ ['no_proxy' ]
1462
1462
1463
1463
def test_proxy_no_proxy_all (self ):
1464
- os .environ ['no_proxy' ] = '*'
1464
+ env = self .enterContext (os_helper .EnvironmentVarGuard ())
1465
+ env ['no_proxy' ] = '*'
1465
1466
o = OpenerDirector ()
1466
1467
ph = urllib .request .ProxyHandler (dict (http = "proxy.example.com" ))
1467
1468
o .add_handler (ph )
1468
1469
req = Request ("http://www.python.org" )
1469
1470
self .assertEqual (req .host , "www.python.org" )
1470
1471
o .open (req )
1471
1472
self .assertEqual (req .host , "www.python.org" )
1472
- del os .environ ['no_proxy' ]
1473
1473
1474
1474
def test_proxy_https (self ):
1475
1475
o = OpenerDirector ()
You can’t perform that action at this time.
0 commit comments