[Python-checkins] r72636 - in python/trunk: Lib/distutils/tests/test_build_ext.py Misc/NEWS

tarek.ziade python-checkins at python.org
Thu May 14 22:14:14 CEST 2009


Author: tarek.ziade
Date: Thu May 14 22:14:13 2009
New Revision: 72636

Log:
#6022 fixed test_get_outputs so it doesn't leaves a test file in the cwd

Modified:
   python/trunk/Lib/distutils/tests/test_build_ext.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/trunk/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/trunk/Lib/distutils/tests/test_build_ext.py	Thu May 14 22:14:13 2009
@@ -312,12 +312,18 @@
 
         # issue #5977 : distutils build_ext.get_outputs
         # returns wrong result with --inplace
-        cmd.inplace = 1
-        cmd.run()
-        so_file = cmd.get_outputs()[0]
+        other_tmp_dir = os.path.realpath(self.mkdtemp())
+        old_wd = os.getcwd()
+        os.chdir(other_tmp_dir)
+        try:
+            cmd.inplace = 1
+            cmd.run()
+            so_file = cmd.get_outputs()[0]
+        finally:
+            os.chdir(old_wd)
         self.assert_(os.path.exists(so_file))
         so_dir = os.path.dirname(so_file)
-        self.assertEquals(so_dir, os.getcwd())
+        self.assertEquals(so_dir, other_tmp_dir)
 
         cmd.inplace = 0
         cmd.run()

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu May 14 22:14:13 2009
@@ -293,6 +293,9 @@
 Library
 -------
 
+- Issue #6022: a test file was created in the current working directory by
+  test_get_outputs in Distutils.
+
 - Issue #4050: inspect.findsource/getsource now raise an IOError if the 'source'
   file is a binary.  Patch by Brodie Rao, tests by Daniel Diniz.
 


More information about the Python-checkins mailing list