#NEWLINE# @ patch . multiple ( 'gevent' , spawn = DEFAULT , joinall = DEFAULT ) #NEWLINE# @ patch . multiple ( 'failnozzle.server' , pager = DEFAULT , mailer = DEFAULT ) #NEWLINE# def test_flusher_rate_excede( spawn , joinall , pager , mailer ) : #NEWLINE# #INDENT# '\n    Test that we complain extra loudly if we get too many errors.\n    ' #NEWLINE# template_dir = os . path . join ( os . path . dirname ( __file__ ) , '..' ) #NEWLINE# pager_window = 5 #NEWLINE# pager_limit = 10 #NEWLINE# message_rate = MessageRate ( pager_window , pager_limit ) #NEWLINE# spawn_ret_val = object ( ) #NEWLINE# spawn . return_value = pager #NEWLINE# env = Environment ( loader = FileSystemLoader ( template_dir ) ) #NEWLINE# message_buffer = MessageBuffer ( env . get_template ( 'subject-template.txt' ) , env . get_template ( 'body-template.txt' ) ) #NEWLINE# for i in range ( ( pager_limit + 1 ) ) : #NEWLINE# #INDENT# message_buffer . add ( UniqueMessage ( 'module' , 'funcName' , 'filename' , 'message' , 'pathname' , i , 'exc_text' , 'kind' ) , 'source' ) #NEWLINE# #UNINDENT# flusher ( message_buffer , message_rate ) #NEWLINE# eq_ ( [ call ( pager , ( pager_limit + 1 ) ) , call ( mailer , ANY , ANY , ANY ) ] , spawn . call_args_list ) #NEWLINE# eq_ ( 2 , spawn . call_count ) #NEWLINE# eq_ ( 1 , joinall . call_count ) #NEWLINE# joinall . assert_called_once_with ( ( [ spawn_ret_val ] * 2 ) )