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

This commit is contained in:
Tarek Ziadé 2009-05-14 20:14:13 +00:00
parent 878555401e
commit cbb4f9ef58
2 changed files with 13 additions and 4 deletions

View File

@ -312,12 +312,18 @@ class BuildExtTestCase(support.TempdirManager,
# issue #5977 : distutils build_ext.get_outputs # issue #5977 : distutils build_ext.get_outputs
# returns wrong result with --inplace # returns wrong result with --inplace
cmd.inplace = 1 other_tmp_dir = os.path.realpath(self.mkdtemp())
cmd.run() old_wd = os.getcwd()
so_file = cmd.get_outputs()[0] 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)) self.assert_(os.path.exists(so_file))
so_dir = os.path.dirname(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.inplace = 0
cmd.run() cmd.run()

View File

@ -293,6 +293,9 @@ Core and Builtins
Library 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' - Issue #4050: inspect.findsource/getsource now raise an IOError if the 'source'
file is a binary. Patch by Brodie Rao, tests by Daniel Diniz. file is a binary. Patch by Brodie Rao, tests by Daniel Diniz.