#NEWLINE# @ mock . patch . object ( console_utils , '_get_console_pid_file' , autospec = True ) #NEWLINE# def test__get_console_pid_not_a_num( self , mock_exec ) : #NEWLINE# #INDENT# tmp_file_handle = tempfile . NamedTemporaryFile ( ) #NEWLINE# tmp_file = tmp_file_handle . name #NEWLINE# self . addCleanup ( ironic_utils . unlink_without_raise , tmp_file ) #NEWLINE# with open ( f , 'w' ) as f : #NEWLINE# #INDENT# f . write ( 'Hello World\n' ) #NEWLINE# #UNINDENT# mock_exec . return_value = tmp_file #NEWLINE# self . assertRaises ( exception . NoConsolePid , console_utils . _get_console_pid , self . info [ 'uuid' ] ) #NEWLINE# mock_exec . assert_called_once_with ( self . info [ 'uuid' ] )