UAT_fileManage.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding:utf-8 -*-
  2. from ssat_sdk.sat_environment import getMenuTree3SelectedProjectCfgPath
  3. from UAT_log import debug,info,error
  4. import os, sys, time
  5. DEBUG = True
  6. INFO = True
  7. ERROR = True
  8. class UATFileManage():
  9. cls="UATFileManage"
  10. def __init__(self):
  11. self.UATreeDir = getMenuTree3SelectedProjectCfgPath()
  12. info(self.cls, "__init__", "UATreeDir:" + str(self.UATreeDir), INFO)
  13. def getUATreeList(self):
  14. fileList = os.listdir(self.UATreeDir)
  15. treeList = []
  16. for filePath in fileList:
  17. if filePath.lower().startswith("uatree") and (filePath.lower().endswith(".xls") or filePath.lower().endswith(".xlsx")):
  18. treeList.append(os.path.join(self.UATreeDir, filePath))
  19. return treeList
  20. def getKeyCodeFile(self):
  21. fileList = os.listdir(self.UATreeDir)
  22. keyCodeFile = None
  23. for filePath in fileList:
  24. if filePath.lower() == "eventkey_code.xlsx":
  25. keyCodeFile = os.path.join(self.UATreeDir, filePath)
  26. break
  27. return keyCodeFile