diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-14 14:35:51 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-14 14:35:51 (GMT) |
commit | c1375d5e0168450b7411227ad3b95286aa1d70b4 (patch) | |
tree | dc4ab4ce5a44dfe26d8d930aee2418b002d52863 /Lib/distutils/tests/test_build_ext.py | |
parent | 9e8dbbcdcd462efc8f50008c7182dd399de89097 (diff) | |
download | cpython-c1375d5e0168450b7411227ad3b95286aa1d70b4.zip cpython-c1375d5e0168450b7411227ad3b95286aa1d70b4.tar.gz cpython-c1375d5e0168450b7411227ad3b95286aa1d70b4.tar.bz2 |
Merged revisions 69609 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69609 | tarek.ziade | 2009-02-14 15:10:23 +0100 (Sat, 14 Feb 2009) | 1 line
Fix for #5257: refactored all tests in distutils, so they use a temporary directory.
........
Diffstat (limited to 'Lib/distutils/tests/test_build_ext.py')
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 5e42943..91b3de8 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -7,6 +7,7 @@ from io import StringIO from distutils.core import Extension, Distribution from distutils.command.build_ext import build_ext from distutils import sysconfig +from distutils.tests.support import TempdirManager import unittest from test import support @@ -19,11 +20,12 @@ def _get_source_filename(): srcdir = sysconfig.get_config_var('srcdir') return os.path.join(srcdir, 'Modules', 'xxmodule.c') -class BuildExtTestCase(unittest.TestCase): +class BuildExtTestCase(TempdirManager, unittest.TestCase): def setUp(self): # Create a simple test environment # Note that we're making changes to sys.path - self.tmp_dir = tempfile.mkdtemp(prefix="pythontest_") + TempdirManager.setUp(self) + self.tmp_dir = self.mkdtemp() self.sys_path = sys.path[:] sys.path.append(self.tmp_dir) shutil.copy(_get_source_filename(), self.tmp_dir) @@ -74,8 +76,7 @@ class BuildExtTestCase(unittest.TestCase): # Get everything back to normal support.unload('xx') sys.path = self.sys_path - # XXX on Windows the test leaves a directory with xx module in TEMP - shutil.rmtree(self.tmp_dir, os.name == 'nt' or sys.platform == 'cygwin') + TempdirManager.tearDown(self) def test_solaris_enable_shared(self): dist = Distribution({'name': 'xx'}) |