#NEWLINE# @ mock . patch . object ( os , 'makedirs' , autospec = True ) #NEWLINE# @ mock . patch . object ( os . path , 'exists' , autospec = True ) #NEWLINE# def test__ensure_console_pid_dir_exists_fail( self , mock_path_exists , mock_makedirs ) : #NEWLINE# #INDENT# mock_path_exists . return_value = False #NEWLINE# mock_makedirs . side_effect = OSError #NEWLINE# pid_dir = console_utils . _get_console_pid_dir ( ) #NEWLINE# self . assertRaises ( exception . ConsoleError , console_utils . _ensure_console_pid_dir_exists ) #NEWLINE# mock_path_exists . assert_called_once_with ( pid_dir ) #NEWLINE# mock_makedirs . assert_called_once_with ( pid_dir )