#NEWLINE# def testScenario( self ) : #NEWLINE# #INDENT# 'Test that a scenario properly handles log messages.' #NEWLINE# fake_device = object ( ) #NEWLINE# def _ScenarioOne( device , logger , callback ) : #NEWLINE# #INDENT# self . assertTrue ( ( device is fake_device ) ) #NEWLINE# logger . info ( 'Info message' ) #NEWLINE# callback ( ) #NEWLINE# #UNINDENT# scenario = Scenario ( 'My Scenario' , _ScenarioOne , 0.5 ) #NEWLINE# catcher = LogCatcher ( 5 , self . stop ) #NEWLINE# with catcher : #NEWLINE# #INDENT# scenario . StartLoop ( self ) #NEWLINE# self . wait ( timeout = 10 ) #NEWLINE# #UNINDENT# self . assertEqual ( 5 , len ( catcher . saved_records ) ) #NEWLINE# for r in catcher . saved_records : #NEWLINE# #INDENT# self . assertEqual ( r . scenario , 'My Scenario' ) #NEWLINE# self . assertEqual ( r . levelno , logging . INFO )