mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28435: Avoid no_proxy environment variable interfering with tests
Patch by Piotr Szczepaniak.
This commit is contained in:
parent
d60ea5ff00
commit
1002a621c1
2 changed files with 10 additions and 0 deletions
|
@ -323,6 +323,14 @@ class ProxyAuthTests(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
super(ProxyAuthTests, self).setUp()
|
||||
# Ignore proxy bypass settings in the environment.
|
||||
def restore_environ(old_environ):
|
||||
os.environ.clear()
|
||||
os.environ.update(old_environ)
|
||||
self.addCleanup(restore_environ, os.environ.copy())
|
||||
os.environ['NO_PROXY'] = ''
|
||||
os.environ['no_proxy'] = ''
|
||||
|
||||
self.digest_auth_handler = DigestAuthHandler()
|
||||
self.digest_auth_handler.set_users({self.USER: self.PASSWD})
|
||||
self.digest_auth_handler.set_realm(self.REALM)
|
||||
|
@ -445,6 +453,7 @@ class TestUrlopen(unittest.TestCase):
|
|||
os.environ.update(old_environ)
|
||||
self.addCleanup(restore_environ, os.environ.copy())
|
||||
os.environ['NO_PROXY'] = '*'
|
||||
os.environ['no_proxy'] = '*'
|
||||
|
||||
def urlopen(self, url, data=None, **kwargs):
|
||||
l = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue