mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
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. ........
This commit is contained in:
parent
9e8dbbcdcd
commit
c1375d5e01
8 changed files with 59 additions and 62 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue