mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Merged revisions 75491 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r75491 | tarek.ziade | 2009-10-18 13:34:51 +0200 (Sun, 18 Oct 2009) | 9 lines
Merged revisions 75485 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75485 | tarek.ziade | 2009-10-18 11:28:26 +0200 (Sun, 18 Oct 2009) | 1 line
Changed distutils tests to avoid environment alteration
........
................
This commit is contained in:
parent
6eb181a668
commit
f456a155c6
13 changed files with 66 additions and 34 deletions
|
|
@ -37,15 +37,17 @@ class TestDistribution(Distribution):
|
|||
|
||||
|
||||
class DistributionTestCase(support.LoggingSilencer,
|
||||
support.EnvironGuard,
|
||||
unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DistributionTestCase, self).setUp()
|
||||
self.argv = sys.argv[:]
|
||||
self.argv = sys.argv, sys.argv[:]
|
||||
del sys.argv[1:]
|
||||
|
||||
def tearDown(self):
|
||||
sys.argv[:] = self.argv
|
||||
sys.argv = self.argv[0]
|
||||
sys.argv[:] = self.argv[1]
|
||||
super(DistributionTestCase, self).tearDown()
|
||||
|
||||
def create_distribution(self, configfiles=()):
|
||||
|
|
@ -159,6 +161,15 @@ class DistributionTestCase(support.LoggingSilencer,
|
|||
class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
|
||||
unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(MetadataTestCase, self).setUp()
|
||||
self.argv = sys.argv, sys.argv[:]
|
||||
|
||||
def tearDown(self):
|
||||
sys.argv = self.argv[0]
|
||||
sys.argv[:] = self.argv[1]
|
||||
super(MetadataTestCase, self).tearDown()
|
||||
|
||||
def test_simple_metadata(self):
|
||||
attrs = {"name": "package",
|
||||
"version": "1.0"}
|
||||
|
|
@ -257,14 +268,14 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
|
|||
|
||||
# linux-style
|
||||
if sys.platform in ('linux', 'darwin'):
|
||||
self.environ['HOME'] = temp_dir
|
||||
os.environ['HOME'] = temp_dir
|
||||
files = dist.find_config_files()
|
||||
self.assertTrue(user_filename in files)
|
||||
|
||||
# win32-style
|
||||
if sys.platform == 'win32':
|
||||
# home drive should be found
|
||||
self.environ['HOME'] = temp_dir
|
||||
os.environ['HOME'] = temp_dir
|
||||
files = dist.find_config_files()
|
||||
self.assertTrue(user_filename in files,
|
||||
'%r not found in %r' % (user_filename, files))
|
||||
|
|
@ -280,15 +291,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
|
|||
def test_show_help(self):
|
||||
# smoke test, just makes sure some help is displayed
|
||||
dist = Distribution()
|
||||
old_argv = sys.argv
|
||||
sys.argv = []
|
||||
try:
|
||||
dist.help = 1
|
||||
dist.script_name = 'setup.py'
|
||||
with captured_stdout() as s:
|
||||
dist.parse_command_line()
|
||||
finally:
|
||||
sys.argv = old_argv
|
||||
dist.help = 1
|
||||
dist.script_name = 'setup.py'
|
||||
with captured_stdout() as s:
|
||||
dist.parse_command_line()
|
||||
|
||||
output = [line for line in s.getvalue().split('\n')
|
||||
if line.strip() != '']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue