test_urllib would set environment variable NO_PROXY without removing it afterwards.
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 6568732..a46f421 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -130,10 +130,14 @@
os.environ[k] = v
def test_getproxies_environment_keep_no_proxies(self):
- os.environ['NO_PROXY'] = 'localhost'
- proxies = urllib.request.getproxies_environment()
- # getproxies_environment use lowered case truncated (no '_proxy') keys
- self.assertEquals('localhost', proxies['no'])
+ try:
+ os.environ['NO_PROXY'] = 'localhost'
+ proxies = urllib.request.getproxies_environment()
+ # getproxies_environment use lowered case truncated (no '_proxy') keys
+ self.assertEquals('localhost', proxies['no'])
+ finally:
+ # The old value will be restored by tearDown, if applicable.
+ del os.environ['NO_PROXY']
class urlopen_HttpTests(unittest.TestCase):