Commit 070e8467 authored by Martin Panter's avatar Martin Panter

Issue #28435: Avoid no_proxy environment variable interfering with tests

Patch by Piotr Szczepaniak.
parent 9a28fb4d
......@@ -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 = []
......
......@@ -1450,6 +1450,7 @@ Al Sweigart
Thenault Sylvain
Péter Szabó
John Szakmeister
Piotr Szczepaniak
Amir Szekely
Maciej Szulik
Arfrever Frehtes Taifersar Arahesis
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment