示例#1
0
 def __init__(self):
     JSONFILE = "config.json"
     YAMLFILE = "config.yaml"
     if os.path.exists(JSONFILE):
         f = open(JSONFILE, 'r', encoding="utf-8")
         self.argstr = json.load(f)
         if self.warning_message(self.argstr):
             raise ArgmentError(Exception,
                                "使用老json格式,需要换成新的配置文件!{0}".format(MESSAGE))
         logger.info("获取运行参数 {0}".format(self.argstr))
     elif os.path.exists(YAMLFILE):
         file = open(YAMLFILE, 'r', encoding="utf-8")
         file_data = file.read()
         file.close()
         self.argstr = yaml.load(file_data, Loader=yaml.FullLoader)
         logger.info("获取运行参数 {0}".format(self.argstr))
示例#2
0
 def testsuit_runner(self):
     try:
         return self.argstr['runner']['name']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#3
0
 def jsonfile_path(self):
     try:
         return self.argstr['ski_filepath']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#4
0
 def case_path(self):
     try:
         return self.argstr['case']['path']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#5
0
 def report_path(self):
     try:
         return self.argstr['report']['path']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#6
0
 def mode(self):
     try:
         return self.argstr['unittestcase']['mode']
     except Exception as e:
         raise ArgmentError(e, "mode 参数配置错误")
示例#7
0
 def log_level(self):
     try:
         return self.argstr['log']['level']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#8
0
 def log_filepath(self):
     try:
         return self.argstr['log']['file_path']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#9
0
 def pytest_commands(self):
     try:
         return self.argstr['runner']['commands']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#10
0
 def auto_model_path(self):
     try:
         return self.argstr['auto']['model_path']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")
示例#11
0
 def report_add_time(self):
     try:
         return self.argstr['report']['addtime.now']
     except Exception as e:
         raise ArgmentError(e, "参数配置错误")