12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- ##################################################################
- #
- # Copyright (c) 2023 CICV, Inc. All Rights Reserved
- #
- ##################################################################
- """
- @Authors: yangzihao(yangzihao@china-icv.cn)
- @Data: 2024/01/30
- @Last Modified: 2024/01/30
- @Summary: Evaluateion functions
- """
- import os
- import sys
- sys.path.append('../config')
- sys.path.append('../common')
- sys.path.append('../modules')
- sys.path.append('../results')
- import json
- import traceback
- import log
- from common import json2dict
- from config_parser import ConfigParse
- from multi_cases_evaluate import multi_case_statistic
- def multiple_cases_eval(configPath, singleReportPath, reportPath):
- logger = log.get_logger()
- # 加载配置文件
- try:
- # json_file = os.path.join(configPath, 'config.json')
- config = ConfigParse(configPath)
- except Exception as e:
- print('Config file parsing ERROR!', e)
- logger.error("MULTIPLE_CASES_EVAL: Config file parsing ERROR!")
- sys.exit(-1)
- # 加载各单用例报告字典
- try:
- cases_dict = json2dict(singleReportPath)
- except Exception as e:
- print('Cases dict file parsing ERROR!', e)
- logger.error("MULTIPLE_CASES_EVAL: Cases dict config file parsing ERROR!")
- sys.exit(-1)
- # 生成多用例报告
- try:
- # multiple cases report statistic and generate
- multi_dict = multi_case_statistic(cases_dict, config)
- with open(f'{reportPath}', 'w', encoding='utf-8') as f:
- f.write(json.dumps(multi_dict, ensure_ascii=False))
- except:
- traceback.print_exc()
- print(1)
- logger.error("MULTIPLE_CASES_EVAL: Evaluate multiple cases ERROR!")
- sys.exit(-1)
|