summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2_localnet.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-10-22 01:42:06 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-10-22 01:42:06 (GMT)
commit1002a621c1f0c8d5adcdd6462b9bdd0470e34290 (patch)
treeddb978736a5dca5cd7a3e3f31bce1c0ea5fb015e /Lib/test/test_urllib2_localnet.py
parentd60ea5ff009e7e48be78c388f642cd64287655f7 (diff)
downloadcpython-1002a621c1f0c8d5adcdd6462b9bdd0470e34290.zip
cpython-1002a621c1f0c8d5adcdd6462b9bdd0470e34290.tar.gz
cpython-1002a621c1f0c8d5adcdd6462b9bdd0470e34290.tar.bz2
Issue #28435: Avoid no_proxy environment variable interfering with tests
Patch by Piotr Szczepaniak.
Diffstat (limited to 'Lib/test/test_urllib2_localnet.py')
-rw-r--r--Lib/test/test_urllib2_localnet.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index e9564fd..68c523a 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -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 = []