mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +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,8 +1,10 @@
|
|||
"""Tests for distutils.ccompiler."""
|
||||
import os
|
||||
import unittest
|
||||
from test.support import captured_stdout
|
||||
|
||||
from distutils.ccompiler import gen_lib_options
|
||||
from distutils.ccompiler import gen_lib_options, CCompiler
|
||||
from distutils import debug
|
||||
|
||||
class FakeCompiler(object):
|
||||
def library_dir_option(self, dir):
|
||||
|
@ -30,6 +32,26 @@ class CCompilerTestCase(unittest.TestCase):
|
|||
'-lname2']
|
||||
self.assertEquals(opts, wanted)
|
||||
|
||||
def test_debug_print(self):
|
||||
|
||||
class MyCCompiler(CCompiler):
|
||||
executables = {}
|
||||
|
||||
compiler = MyCCompiler()
|
||||
with captured_stdout() as stdout:
|
||||
compiler.debug_print('xxx')
|
||||
stdout.seek(0)
|
||||
self.assertEquals(stdout.read(), '')
|
||||
|
||||
debug.DEBUG = True
|
||||
try:
|
||||
with captured_stdout() as stdout:
|
||||
compiler.debug_print('xxx')
|
||||
stdout.seek(0)
|
||||
self.assertEquals(stdout.read(), 'xxx\n')
|
||||
finally:
|
||||
debug.DEBUG = False
|
||||
|
||||
def test_suite():
|
||||
return unittest.makeSuite(CCompilerTestCase)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue