Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.11 KB | None | 0 0
  1. import os.path
  2. import sys
  3. import win32api
  4.  
  5. # Create the search path to the APV if it doesn't exist
  6. APVPath = os.path.abspath(".")   # path to the APV if tseq.py started
  7. APVPathAlternative = os.path.abspath(".//..")  # path to the APV if TestEditor.py started directly
  8. if not sys.path.count(APVPath):
  9.     sys.path.insert(0, APVPath)
  10. if not sys.path.count(APVPathAlternative):
  11.     sys.path.insert(0, APVPathAlternative)
  12.    
  13. import CTest
  14. import SQSTestParser
  15. import SQSINIFile
  16. import SQSFrameClass
  17.  
  18. startDir = os.path.dirname(sys.argv[0])
  19. startDir = os.path.split(startDir)[0]
  20. if os.path.isdir(startDir) == 0:
  21.     startDir = os.getcwd()
  22.  
  23.  
  24. # This function is copied from tseq.py (importing tseq.py doesn't work here)
  25. def addLogfiles(ResDesc, AdditionalLogfiles, res):
  26.     if len(AdditionalLogfiles) > 0:
  27.         for al in AdditionalLogfiles:
  28.             # take the result given with the Logfile
  29.             if al[2] > res:
  30.                 res = al[2]
  31.             testName = None
  32.             stepId = None
  33.             if len(al) > 3:
  34.                 testName = al[3]
  35.                 stepId = int(al[4])
  36.             ResDesc.AddTestResultFile(al[0],al[1],al[2], testName=testName, stepId=stepId)
  37.     return res
  38.  
  39.  
  40. m_cTest = CTest.CTest()
  41.  
  42. try:
  43.     import pythoncom
  44.     #pythoncom.CoInitialize()
  45.    
  46.     # open the ini file from the commanline parameter
  47.     inifile = SQSINIFile.SQSINIFile(sys.argv[1])
  48.     inifile = inifile.ReadINIFile()
  49.    
  50.     # Set info to execute test
  51.     m_cTest.m_errfilename  = inifile.sections["DebugParameters"].data["m_errfilename"]
  52.     m_cTest.m_version      = inifile.sections["DebugParameters"].data["m_version"]
  53.     m_cTest.m_date         = inifile.sections["DebugParameters"].data["m_date"]
  54.     m_cTest.m_Name         = inifile.sections["DebugParameters"].data["m_Name"]
  55.     m_cTest.m_author       = inifile.sections["DebugParameters"].data["m_author"]
  56.     m_cTest.m_testGroup    = inifile.sections["DebugParameters"].data["m_testGroup"]
  57.     m_cTest.m_File         = inifile.sections["DebugParameters"].data["m_File"]
  58.     m_cTest.m_Dir          = inifile.sections["DebugParameters"].data["m_Dir"]
  59.     StepByStep             = inifile.sections["DebugParameters"].data["StepByStep"].lower() == "true"
  60.     m_cTest.newLogfile()
  61.     SQSTestParser.SQSTestParser(m_cTest, os.path.join(m_cTest.m_Dir, m_cTest.m_File), debugMode=True, StepByStep=StepByStep)
  62.     m_cTest.m_ErrLog.result(m_cTest.m_Name)
  63.    
  64.     # Add additional logfiles and images to the temporary result folder
  65.     TestDesc = SQSFrameClass.CTestDoc()
  66.     ResDesc = SQSFrameClass.CResultDoc(TestDesc)
  67.     ResDesc.ReadProfileFile(startDir+"\\tseq.ini")
  68.     ResDesc.m_TestSeqNum = 0
  69.     ResDesc.m_TmpBasePath = os.path.join(win32api.GetTempPath(), m_cTest.m_tTmpSubDir)
  70.     ResDesc.m_PathToTestSeq = [m_cTest.m_testGroup]
  71.     ResDesc.m_PathToResData = [[]]
  72.     ResDesc.m_filesChkInPath = [[]]
  73.     ResDesc.m_ResultOfResData = [[]]
  74.     ResDesc.m_DescriptionOfResData = [[]]
  75.     addLogfiles(ResDesc, m_cTest.m_AdditionalLogfiles, 0)
  76.    
  77.     pythoncom.CoUninitialize()
  78. except:
  79.     import traceback
  80.     traceback.print_exc()
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement