summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_cmd.py')
-rw-r--r--Lib/distutils/tests/test_cmd.py18
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)