#NEWLINE# @ patch ( 'pyon.container.procs.log' ) #NEWLINE# def test_stop_with_error( self , mocklog ) : #NEWLINE# #INDENT# self . pm . start ( ) #NEWLINE# self . pm . terminate_process = Mock ( side_effect = BadRequest ) #NEWLINE# procmock = Mock ( ) #NEWLINE# procmock . _proc_start_time = 0 #NEWLINE# procmock . id = sentinel . pid #NEWLINE# self . pm . procs [ sentinel . pid ] = procmock #NEWLINE# self . pm . procs_by_name [ 'dummy' ] = procmock #NEWLINE# self . pm . stop ( ) #NEWLINE# self . pm . terminate_process . assert_called_once_with ( sentinel . pid ) #NEWLINE# mocklog . warn . assert_has_calls ( [ call ( 'Failed to terminate process (%s): %s' , sentinel . pid , ANY ) , call ( 'ProcManager procs not empty: %s' , procmock . pm . procs ) , call ( 'ProcManager procs_by_name not empty: %s' , self . pm . procs_by_name ) ] )