#NEWLINE# def wait_for_messages( self , n = 1 ) : #NEWLINE# #INDENT# accumulate_time = 0.0 #NEWLINE# while ( len ( self . messages ) < n ) : #NEWLINE# #INDENT# time . sleep ( 0.1 ) #NEWLINE# accumulate_time += 0.05 #NEWLINE# if ( accumulate_time > 3.0 ) : #NEWLINE# #INDENT# raise Exception ( 'Waited too long for messages.' )