config
This commit is contained in:
parent
93f2f16987
commit
73d580a62f
@ -1104,8 +1104,40 @@ async def run_api_tests(config: TestConfig):
|
|||||||
report_directory_path = (Path(REPORTS_DIR) / report_id).resolve()
|
report_directory_path = (Path(REPORTS_DIR) / report_id).resolve()
|
||||||
|
|
||||||
# Prepare config
|
# Prepare config
|
||||||
config_dict = config.dict()
|
if hasattr(config, "model_dump"):
|
||||||
mode = config_dict.pop('mode')
|
raw_config = config.model_dump(exclude_none=True)
|
||||||
|
else:
|
||||||
|
raw_config = config.dict(exclude_none=True)
|
||||||
|
|
||||||
|
mode = raw_config.pop('mode')
|
||||||
|
|
||||||
|
hidden_defaults = {
|
||||||
|
"categories": [],
|
||||||
|
"tags": [],
|
||||||
|
"ignore_ssl": True,
|
||||||
|
"output": "./test_reports",
|
||||||
|
"generate_pdf": True,
|
||||||
|
"custom_test_cases_dir": "./custom_testcases",
|
||||||
|
"stages_dir": "./custom_stages",
|
||||||
|
"llm_api_key": "sk-lbGrsUPL1iby86h554FaE536C343435dAa9bA65967A840B2",
|
||||||
|
"llm_base_url": "https://aiproxy.petrotech.cnpc/v1",
|
||||||
|
"llm_model_name": "deepseek-v3",
|
||||||
|
"use_llm_for_request_body": False,
|
||||||
|
"use_llm_for_path_params": False,
|
||||||
|
"use_llm_for_query_params": False,
|
||||||
|
"use_llm_for_headers": False,
|
||||||
|
"verbose": False
|
||||||
|
}
|
||||||
|
|
||||||
|
config_dict = {**hidden_defaults, **raw_config}
|
||||||
|
|
||||||
|
for default_path_key in ("custom_test_cases_dir", "stages_dir"):
|
||||||
|
default_path = config_dict.get(default_path_key)
|
||||||
|
if default_path:
|
||||||
|
try:
|
||||||
|
Path(default_path).mkdir(parents=True, exist_ok=True)
|
||||||
|
except Exception as path_error:
|
||||||
|
logger.warning(f"无法创建默认目录 {default_path}: {path_error}")
|
||||||
|
|
||||||
# Set file paths based on mode
|
# Set file paths based on mode
|
||||||
if mode == 'yapi':
|
if mode == 'yapi':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user