當前位置: 首頁>>代碼示例>>Python>>正文


Python Log.exception方法代碼示例

本文整理匯總了Python中log.Log.Log.exception方法的典型用法代碼示例。如果您正苦於以下問題:Python Log.exception方法的具體用法?Python Log.exception怎麽用?Python Log.exception使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在log.Log.Log的用法示例。


在下文中一共展示了Log.exception方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: bind

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def bind (self, heads, expandColumnsTag = None):
     self.columnBindings = [None] * heads.size()
     i = 0
     while heads:
         name = heads.text()
         # strip ' ','\n'
         name = name.replace(' ', '')
         name = name.replace('\n','')
         sufix = "()"
         try:
             if name[-len(sufix):] == sufix:
                 self.columnBindings[i] = \
                     self.bindMethod(name[:-len(sufix)])
                 if expandColumnsTag is not None: 
                     setattr(self, 'rowspan', 2) # added  in  2009/08/21, the first row means show test result, second test data      
                     style = heads.getStyle()
                     if style is None:
                         style = ''
                     try:
                         heads.addToBody(self.getExpandheads(style))
                     except AttributeError, e:
                         Log.info('please implement getExpandheads()!')
                         Log.exception(e)
             else: # name is field 
                 self.columnBindings[i] = self.bindField(name)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:27,代碼來源:ColumnFixture.py

示例2: doTables

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def doTables(self,tables, expandColumnsTag = None) :
     self.summary["run date"] = time.ctime(time.time())
     self.summary["run elapsed time"] = RunTime()
     while tables:
         try:
             heading = tables.at(0,0,0)
             if expandColumnsTag is not None:
                 tempTuple = expandColumnsTag.split('=')
                 heading.modifyTagValue(tempTuple[0], tempTuple[1])
         except BaseException, e:
             Log.exception(e)                 
         if heading:
             try:
                 path = heading.text()
                 #path = re.sub(r'^fit\.','',path) #try to cure the fits of madness
                 _CLASSNAME = path.split('.')[-1]
                 # fix for illegal Java trick in AllFiles. Frankly, I like it!
                 i = path.split('$')
                 if len(i) == 1:
                     exec 'import '+path
                     #test class method
                     exec 'fixture = '+path+'.'+_CLASSNAME+'()' 
                 else:
                     exec "import %s" % (i[0],)
                     exec "fixture = %s.%s()" % (i[0], i[1])
                 fixture.counts = self.counts
                 fixture.summary = self.summary
                 fixture.doTable(tables, expandColumnsTag)
             except Exception, e:
                 self.exception(heading, e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:32,代碼來源:Fixture.py

示例3: doSheet

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def doSheet(self, excelAPP, sheetName):
     Log.debug('start: ExcelColumnFixture.doSheet')
     sheet = self.excelAPP.getShByName(sheetName)
     self.excelAPP.setSheet(sheet)
     ncols = sheet.ncols
     nrows = sheet.nrows
     try:
         fixturePath, rowpos = self.getFixturePath(0, ncols)
         if fixturePath == '':  # if have not fixture row, use default fixture
             print 'warning:'
             print 'no specify fixture path or fixture in the first row in excel'
             print 'automation will use default fixture, apifixture.TempleteFixture'
             Log.debug('automation use default fixture, apifixture.TempleteFixture')
             fixturePath = 'apifixture.TempleteFixture'
             #sys.exit(0)
             #fixturePath = 'apifixture.TempleteFixture'
         _CLASSNAME = fixturePath.split('.')[-1]
         i = fixturePath.split('$')
         if len(i) == 1:
             exec 'import ' + fixturePath
             # test class method
             exec 'fixture = ' + fixturePath + '.' + _CLASSNAME + '()' 
         else:
             exec "import %s" % (i[0],)
             exec "fixture = %s.%s()" % (i[0], i[1])
     except ImportError, e:
         Log.exception(e)
         print 'fixturePath does not exists'
         print 'system exit'
         return
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:32,代碼來源:ExcelColumnFixture.py

示例4: runTest

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def runTest(self):
     Log.debug('start: DcgFixture.runTest')
     print 'now start to test......'
     starttime = datetime.datetime.now()
     runTime = 0
     try:
         Log.info('iteration count: ' + str(GlobalSetting.ITERATION))
         iterationCount = GlobalSetting.ITERATION
         if type(iterationCount) != types.IntType:
             iterationCount = 0
         while True:       
             path = 'reports\\'
             if not os.path.exists(path):
                 os.mkdir(path)   
             dcg = TextFixture() 
             dcg.doTextTest(self.textfilename, path + self.outreportname)
             endtime = datetime.datetime.now()
             runTime = (endtime - starttime).seconds
             print 'run time(seconds) is: ' + str(runTime)
             try:
                 if GlobalSetting.RUNTIME > 0:
                     if runTime > GlobalSetting.RUNTIME:
                         break
                 elif iterationCount < 1:
                     break
             except BaseException, e:
                 Log.exception(e)
                 break              
             iterationCount -= 1
     except (KeyboardInterrupt, SystemExit), e:
             print 'user Interrupt test'
             Log.exception(e)
             os._exit(0)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:35,代碼來源:TextRunner.py

示例5: openReport

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def openReport(self):
     Log.debug(self.reportNameList)
     for reportName in self.reportNameList:
         try:
             print reportName
             webbrowser.open_new(reportName)
         except BaseException, e:
             Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:10,代碼來源:ExcelColumnFixture.py

示例6: __init__

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def __init__(self, path):
     self.path = path
     print path
     try:
         self.doc = xml.dom.minidom.parse(path)
     except:
         Log.exception('can not create doc document object')
         print 'system exit'
         os._exit(0)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:11,代碼來源:XMLConfiguration.py

示例7: getStyle

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def getStyle(self):
     result = ''
     try:
         place1 = self.tag.find('style')
         if place1 > -1:
             place2 = self.tag.find("'", place1 + 7) # get last "'" of the tag. style = '...'
             if place2 > -1:
                 result = self.tag[place1:place2 + 1]
     except BaseException, e:
         Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:12,代碼來源:Parse.py

示例8: removeChildsOfNode

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def removeChildsOfNode(self, node):
     try:
         if node != None:
             nl = node._get_childNodes()
             for n in nl:
                 if n.nodeType == xml.dom.Node.ELEMENT_NODE:
                     node.removeChild(n)
             Log.debug('have successfully removed element')
     except BaseException, e:
         Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:12,代碼來源:XMLConfiguration.py

示例9: removeTextNodesByNodename

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
 def removeTextNodesByNodename(self, nodeName):
     try:
         elementList = self.getElementList(nodeName)
         for element in elementList:
             if element.nodeType == xml.dom.Node.TEXT_NODE:
                 self.doc.removeChild(element)
                 continue
             else:
                 el = element._get_childNodes()
                 for e in el:
                     if e.nodeType == xml.dom.Node.TEXT_NODE:
                         element.removeChild(e)
     except BaseException, e:
         Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:16,代碼來源:XMLConfiguration.py

示例10: doRows

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
    def doRows(self, rowpos, nrows, ncols):
        Log.debug('start: ExcelColumnFixture.doRows')
        self.title, rowpos = self.getTitle(rowpos, ncols)
        rowpos = self.processHeads(rowpos, ncols)
        #setup before test
        if hasattr(self, 'initSetupFixture') and self.initSetupFixture:
            self.runInitSetupFixture()
        self.repstr = self.getReportHeader(self.curShName, needscrips=True)
        self.failrepstr = self.getReportHeader(self.curShName, needscrips=True)
        self.repstr += self.getReportTableHeader()
        self.failrepstr += self.getReportTableHeader()
        try:
            startcolumnPos = 0
            heads, rowpos = self.getHeads(rowpos, startcolumnPos, ncols)
            self.heads = self.stripHeads(heads)  # strip space , '\n'
            self.colspan = len(self.heads)
            self.repstr += self.getReportTitle(self.title)
            self.failrepstr += self.getReportTitle(self.title)
            #self.processReportHeads()
            if self.note:
                self.repstr += self.getReporth2header(self.note, 'H4')
            if self.interface and self.function:
                self.repstr += self.getReporth2header(self.interface + self.function, 'H3')
                self.failrepstr += self.getReporth2header(self.interface + self.function, 'H3')
            self.repstr += self.getReportTableColumnName(self.heads)
            self.failrepstr += self.getReportTableColumnName(self.heads)
            self.defineVarAndTypeDict(self.heads)  # redefine variable type
#             if hasattr(self, 'testCaseId') == False:
#                 exec 'ExcelColumnFixture.testCaseId = 0'
            Log.debug('heads:', heads)
            self.bind(self.heads)
            row = rowpos
            while row < nrows:
                self.restInitVar()
                rowdata, row = self.doCells(row, startcolumnPos, ncols, nrows)
                self.repstr += self.getReportTableRow(rowdata)
                if self.results[self.testCaseId] == 'fail' :
                    self.failrepstr += self.getReportTableRow(rowdata)
            self.repstr += self.getReportTableTail()
            self.failrepstr += self.getReportTableTail()
            if self.isMakeReporterFlag:
                self.repstr += self.getReportTail(self.counts.toString())
                self.failrepstr += self.getReportTail()
                self.genHtmlfile(self.failrepstr, self.failReportFileName)
                self.genHtmlfile(self.repstr, self.reportFileName)
            self.saveCounts()
        except BaseException, e:
            Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:50,代碼來源:ExcelColumnFixture.py

示例11: doTextTest

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
    def doTextTest(self, textFileName, reportname):
        self.textFileName = textFileName
        self.reportname = reportname
        file_object = open(self.textFileName, 'r')
        try:
            fixturePath = str(file_object.readline())
            fixturePath = self.strip(fixturePath)
            self.urlpath = self.strip(file_object.readline())
            if self.urlpath.find('url:') > -1:
                self.urlpath = self.urlpath.split(':')[-1]
                self.readedLines += 1
            else:
                self.urlpath = ''
            print fixturePath
            if fixturePath.find('fixture') == -1:  # if have not fixture row, use default fixture
                fixturePath = 'fixture.TextFixture'
            else:
                self.readedLines += 1
            _CLASSNAME = fixturePath.split('.')[-1]
            # fix for illegal Java trick in AllFiles. Frankly, I like it!
            i = fixturePath.split('$')
            try:
                if len(i) == 1:
                    exec 'import ' + fixturePath
#                     # test class method
                    exec 'fixture = ' + fixturePath + '.' + _CLASSNAME + '()' 
                else:
                    exec "import %s" % (i[0],)
                    exec "fixture = %s.%s()" % (i[0], i[1])
            except ImportError, e:
                Log.exception(e)
                print 'fixturePath does not exists'
                print 'system exit'
                return
            fixture.fixturePath = fixturePath
            fixture.textFileName = self.textFileName
            fixture.reportname = self.reportname
            fixture.readedLines = self.readedLines
            fixture.urlpath = self.urlpath
            fixture.runTest()
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:42,代碼來源:TextFixture.py

示例12: doRequest

# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import exception [as 別名]
             else:
                 bresult = 0
                 message = "expect result column is null, maybe error!\n the url:%s \n" % self.url
         if bresult > 0:
             self.right(cell, message)
         elif bresult == 0:
             self.wrong(cell, message)
         else:
             self.output(cell, message)
         try:
             cell.text = cell.text + self.link
         except:
             cell.text = self.link
     except BaseException, e:
         self.exception(cell, e)
         Log.exception(e)
     Log.debug('end runTest: ' + self._CLASSNAME)
 
 def doRequest(self, url, reqargs, requestMethod):
     respData = None
     #開始HTTP請求
     try:
         resp = self.client.dorequest(url, reqargs, \
                                      methodname=requestMethod)
         if self.url.find('login') > -1: #如果是一個登陸的url
             self.initInfoBeforeTest['cookie'] = self.client.getCookie(resp.info())
         if isinstance(resp, str):
             respData = resp
         else:
             respData = resp.read()
         Log.debugvar('respData is ', respData)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:33,代碼來源:HttpApiFixture.py


注:本文中的log.Log.Log.exception方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。