[Python-checkins] r68251 - in python/branches/release30-maint: Lib/test/test_urllib.py

antoine.pitrou python-checkins at python.org
Sun Jan 4 00:00:09 CET 2009


Author: antoine.pitrou
Date: Sun Jan  4 00:00:08 2009
New Revision: 68251

Log:
Merged revisions 68249 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r68249 | antoine.pitrou | 2009-01-03 23:55:38 +0100 (sam., 03 janv. 2009) | 3 lines
  
  test_urllib would set environment variable NO_PROXY without removing it afterwards.
........


Modified:
   python/branches/release30-maint/   (props changed)
   python/branches/release30-maint/Lib/test/test_urllib.py

Modified: python/branches/release30-maint/Lib/test/test_urllib.py
==============================================================================
--- python/branches/release30-maint/Lib/test/test_urllib.py	(original)
+++ python/branches/release30-maint/Lib/test/test_urllib.py	Sun Jan  4 00:00:08 2009
@@ -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):


More information about the Python-checkins mailing list