mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
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) ........
This commit is contained in:
parent
eb097fca52
commit
03d5d08798
7 changed files with 97 additions and 6 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue