Skip to content

Commit c3ecb3b

Browse files
committed
fix: apply changes from review feedback
Signed-off-by: Frost Ming <[email protected]>
1 parent 4669c44 commit c3ecb3b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/test_urllib2_localnet.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,10 @@ class ProxyAuthTests(unittest.TestCase):
332332

333333
def setUp(self):
334334
super(ProxyAuthTests, self).setUp()
335-
# Ignore proxy bypass settings in the environment.
336-
def restore_environ(old_environ):
337-
os.environ.clear()
338-
os.environ.update(old_environ)
339-
self.addCleanup(restore_environ, os.environ.copy())
340-
self._proxy_bypass = unittest.mock.patch('urllib.request.proxy_bypass', return_value=False)
341-
self._proxy_bypass.start()
342-
self.addCleanup(self._proxy_bypass.stop)
335+
# Patch proxy_bypass temporarily to ignore proxy bypass settings.
336+
proxy_bypass = unittest.mock.patch('urllib.request.proxy_bypass', return_value=False)
337+
proxy_bypass.start()
338+
self.addCleanup(proxy_bypass.stop)
343339

344340
self.digest_auth_handler = DigestAuthHandler()
345341
self.digest_auth_handler.set_users({self.USER: self.PASSWD})

0 commit comments

Comments
 (0)