pykd
1
2import unittest3import target4import pykd5
6class OutHandler( pykd.eventHandler ):7
8def __init__(self):9pykd.eventHandler.__init__(self)10self.out_counter=011self.verbose_counter = 012
13def onDebugOutput(self, text, mask):14if mask == pykd.outputFlag.Normal:15self.out_counter += 116elif mask == pykd.outputFlag.Verbose:17self.verbose_counter += 118
19class OutputHandlerTest( unittest.TestCase ):20
21def setUp(self):22self.oldMask = pykd.getOutputMask()23self.handler = OutHandler()24
25def tearDown(self):26pykd.killAllProcesses()27pykd.setOutputMask(self.oldMask)28
29def testDebugOutput(self):30pykd.startProcess( target.appPath )31self.assertTrue( 0 < self.handler.out_counter)32self.assertFalse( 0 < self.handler.verbose_counter)33
34def testDebugOutputMask(self):35pykd.setOutputMask(pykd.outputFlag.Normal | pykd.outputFlag.Verbose)36pykd.startProcess( target.appPath )37self.assertTrue( 0 < self.handler.out_counter)38self.assertTrue( 0 < self.handler.verbose_counter)