From 3bfbaedd887096a263d14b612c3b2137ad57f29f Mon Sep 17 00:00:00 2001 From: "tarek.ziade" Date: Thu, 14 May 2009 20:14:13 +0000 Subject: [PATCH] #6022 fixed test_get_outputs so it doesn't leaves a test file in the cwd git-svn-id: http://svn.python.org/projects/python/trunk@72636 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Lib/distutils/tests/test_build_ext.py | 14 ++++++++++---- Misc/NEWS | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 45c5b39e0f..c6533ca9f7 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -312,12 +312,18 @@ class BuildExtTestCase(support.TempdirManager, # 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() diff --git a/Misc/NEWS b/Misc/NEWS index 2203621b47..5d7a81ea5c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -293,6 +293,9 @@ Core and Builtins 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. -- 2.11.4.GIT