[Python-checkins] r72502 - in python/branches/py3k: Lib/distutils/tests/test_util.py Misc/NEWS

tarek.ziade python-checkins at python.org
Sat May 9 12:09:11 CEST 2009


Author: tarek.ziade
Date: Sat May  9 12:09:11 2009
New Revision: 72502

Log:
Merged revisions 72500 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72500 | tarek.ziade | 2009-05-09 12:06:00 +0200 (Sat, 09 May 2009) | 1 line
  
  #5976: fixed distutils test_check_environ
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/distutils/tests/test_util.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/distutils/tests/test_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/tests/test_util.py	(original)
+++ python/branches/py3k/Lib/distutils/tests/test_util.py	Sat May  9 12:09:11 2009
@@ -214,12 +214,17 @@
 
         # posix without HOME
         if os.name == 'posix':  # this test won't run on windows
-            os.environ = {}
-            check_environ()
-
-            import pwd
-            self.assertEquals(os.environ['HOME'],
-                              pwd.getpwuid(os.getuid())[5])
+            old_home = os.environ.get('HOME')
+            try:
+                check_environ()
+                import pwd
+                self.assertEquals(os.environ['HOME'],
+                                  pwd.getpwuid(os.getuid())[5])
+            finally:
+                if old_home is not None:
+                    os.environ['HOME'] = old_home
+                else:
+                    del os.environ['HOME']
         else:
             check_environ()
 

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat May  9 12:09:11 2009
@@ -581,6 +581,8 @@
 Library
 -------
 
+- Issue #5976: Fixed Distutils test_check_environ.
+
 - Issue #5941: Distutils build_clib command was not working anymore because
   of an incomplete costumization of the archiver command. Added ARFLAGS in the
   Makefile besides AR and make Distutils use it. Original patch by David


More information about the Python-checkins mailing list