diff options
Diffstat (limited to 'Lib/distutils/tests/test_build_ext.py')
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 4776c18..a6d2d2e 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -285,14 +285,20 @@ 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.assertTrue(os.path.exists(so_file)) self.assertEqual(os.path.splitext(so_file)[-1], sysconfig.get_config_var('SO')) so_dir = os.path.dirname(so_file) - self.assertEqual(so_dir, os.getcwd()) + self.assertEqual(so_dir, other_tmp_dir) cmd.compiler = None cmd.inplace = 0 cmd.run() |