From 1002a621c1f0c8d5adcdd6462b9bdd0470e34290 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sat, 22 Oct 2016 01:42:06 +0000 Subject: [PATCH] Issue #28435: Avoid no_proxy environment variable interfering with tests Patch by Piotr Szczepaniak. --- Lib/test/test_urllib2_localnet.py | 9 +++++++++ Misc/ACKS | 1 + 2 files changed, 10 insertions(+) diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index e9564fde621..68c523abbc0 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 = [] diff --git a/Misc/ACKS b/Misc/ACKS index d35f1e89166..8c5c0c203ff 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1450,6 +1450,7 @@ Al Sweigart Thenault Sylvain Péter Szabó John Szakmeister +Piotr Szczepaniak Amir Szekely Maciej Szulik Arfrever Frehtes Taifersar Arahesis