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_file_util.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_file_util.py')
-rw-r--r-- | Lib/distutils/tests/test_file_util.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Lib/distutils/tests/test_file_util.py b/Lib/distutils/tests/test_file_util.py index 523f1ae..9373af8 100644 --- a/Lib/distutils/tests/test_file_util.py +++ b/Lib/distutils/tests/test_file_util.py @@ -5,8 +5,9 @@ import shutil from distutils.file_util import move_file from distutils import log +from distutils.tests import support -class FileUtilTestCase(unittest.TestCase): +class FileUtilTestCase(support.TempdirManager, unittest.TestCase): def _log(self, msg, *args): if len(args) > 0: @@ -15,24 +16,20 @@ class FileUtilTestCase(unittest.TestCase): self._logs.append(msg) def setUp(self): + support.TempdirManager.setUp(self) self._logs = [] self.old_log = log.info log.info = self._log - self.source = os.path.join(os.path.dirname(__file__), 'f1') - self.target = os.path.join(os.path.dirname(__file__), 'f2') - self.target_dir = os.path.join(os.path.dirname(__file__), 'd1') + tmp_dir = self.mkdtemp() + self.source = os.path.join(tmp_dir, 'f1') + self.target = os.path.join(tmp_dir, 'f2') + self.target_dir = os.path.join(tmp_dir, 'd1') def tearDown(self): log.info = self.old_log - for f in (self.source, self.target, self.target_dir): - if os.path.exists(f): - if os.path.isfile(f): - os.remove(f) - else: - shutil.rmtree(f) + support.TempdirManager.tearDown(self) def test_move_file_verbosity(self): - f = open(self.source, 'w') f.write('some content') f.close() |