diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 (GMT) |
commit | 03d5d087989fc38df2bee68a3f5ed758b0bfa665 (patch) | |
tree | 7a1341e9e5dac79d1d4c84fbae2cdaf2f9723f94 /Lib/distutils/tests/test_cmd.py | |
parent | eb097fca52f47d012df127c7c83d72a8e3881d73 (diff) | |
download | cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.zip cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.tar.gz cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.tar.bz2 |
Merged revisions 74988 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74988 | tarek.ziade | 2009-09-21 14:19:07 +0200 (Mon, 21 Sep 2009) | 1 line
improved distutils test coverage: now the DEBUG mode is covered too (will help fix the issue #6954 in py3k branch)
........
Diffstat (limited to 'Lib/distutils/tests/test_cmd.py')
-rw-r--r-- | Lib/distutils/tests/test_cmd.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_cmd.py b/Lib/distutils/tests/test_cmd.py index d6438b5..55ae421 100644 --- a/Lib/distutils/tests/test_cmd.py +++ b/Lib/distutils/tests/test_cmd.py @@ -1,10 +1,12 @@ """Tests for distutils.cmd.""" import unittest import os +from test.support import captured_stdout from distutils.cmd import Command from distutils.dist import Distribution from distutils.errors import DistutilsOptionError +from distutils import debug class MyCmd(Command): def initialize_options(self): @@ -102,6 +104,22 @@ class CommandTestCase(unittest.TestCase): cmd.option2 = 'xxx' self.assertRaises(DistutilsOptionError, cmd.ensure_dirname, 'option2') + def test_debug_print(self): + cmd = self.cmd + with captured_stdout() as stdout: + cmd.debug_print('xxx') + stdout.seek(0) + self.assertEquals(stdout.read(), '') + + debug.DEBUG = True + try: + with captured_stdout() as stdout: + cmd.debug_print('xxx') + stdout.seek(0) + self.assertEquals(stdout.read(), 'xxx\n') + finally: + debug.DEBUG = False + def test_suite(): return unittest.makeSuite(CommandTestCase) |