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_dist.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_dist.py')
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 8e7ef5d..3ac0fdd 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -9,6 +9,7 @@ import unittest import warnings from test.support import TESTFN +from distutils.tests import support class test_dist(distutils.cmd.Command): @@ -120,7 +121,7 @@ class DistributionTestCase(unittest.TestCase): self.assertEquals(len(warns), 0) -class MetadataTestCase(unittest.TestCase): +class MetadataTestCase(support.TempdirManager, unittest.TestCase): def test_simple_metadata(self): attrs = {"name": "package", @@ -219,8 +220,8 @@ class MetadataTestCase(unittest.TestCase): else: user_filename = "pydistutils.cfg" - curdir = os.path.dirname(__file__) - user_filename = os.path.join(curdir, user_filename) + temp_dir = self.mkdtemp() + user_filename = os.path.join(temp_dir, user_filename) f = open(user_filename, 'w') f.write('.') f.close() @@ -230,14 +231,14 @@ class MetadataTestCase(unittest.TestCase): # linux-style if sys.platform in ('linux', 'darwin'): - os.environ['HOME'] = curdir + os.environ['HOME'] = temp_dir files = dist.find_config_files() self.assert_(user_filename in files) # win32-style if sys.platform == 'win32': # home drive should be found - os.environ['HOME'] = curdir + os.environ['HOME'] = temp_dir files = dist.find_config_files() self.assert_(user_filename in files, '%r not found in %r' % (user_filename, files)) |