• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Python腳本解決一些繁瑣的測試問題

    發表于:2011-05-31來源:未知作者:娃娃點擊數: 標簽:
    用Python腳本:根據文件列表stab_case.txt上面的文件名稱,刪除指定文件夾(包括子文件夾)下面的文件。 #coding=utf-8 import os WORKDIR = os.getcwd()#不必修改 #提供局排錯誤案例信息的報告全集,除非生成的報告名改變否則不必改動 g_ResultTxtName = [sta

      用Python腳本:根據文件列表“stab_case.txt”上面的文件名稱,刪除指定文件夾(包括子文件夾)下面的文件。

      #coding=utf-8

      import os

      WORKDIR = os.getcwd()#不必修改

      #提供局排錯誤案例信息的報告全集,除非生成的報告名改變否則不必改動

      g_ResultTxtName = ['stab_case.txt', ]

      #如果把該程序拷到Cases\\Case下則不需要設置

      #否則寫成如這樣的案例存放的絕對路徑'E:\\render\\Cases\\Case'

      CasePath = WORKDIR

      def deleteFile(filepath):

      try:

      if not os.path.exists(filepath):

      print filepath, "not exist!"

      return 0

      if not os.path.isfile(filepath):

      print filepath, "is not a file!"

      return 0

      os.remove(filepath)

      print "Delete ", filepath, " suclearcase/" target="_blank" >cceded!"

      return 1

      except:

      print "Delete ", filepath, " failed!"

      pass

      return 0

      def analyseReport(txtPath):

      pathList = []

      try:

      report = open(txtPath,'r')

      except Exception,ex:

      print str(Exception),':',str(ex)

      report.close()

      return pathList

      for line in report:

      if len(line) <= len('\n'):

      continue

      #line = line.decode('cp936')

      pathList.append(line[:-1])#去掉開頭的\t和最后的\n

      report.close()

      pathList.sort()

      return pathList

      if '__main__' == __name__:

      for item in g_ResultTxtName:

      txtPath = os.path.join(WORKDIR, item)

      pathList = []

      if os.path.exists(txtPath):

      pathList = analyseReport(txtPath)

      for Path in pathList:

      docPath = os.path.join(CasePath, Path)

      deleteFile(docPath)

      print 'Delete Over'

      os.system("pause")

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>