- 新增 pytest_addoption 增加 "--caps_name" 获取配置文件中的设备/平台名称 - 修复 get_caps 的 Capabilities 加载逻辑 - 优化 其他优化 enums.py - 删除 移除部分文档,代码,第三方包(loguru)
29 lines
620 B
Python
29 lines
620 B
Python
#!/usr/bin/env python
|
|
# coding=utf-8
|
|
|
|
"""
|
|
@author: CNWei,ChenWei
|
|
@Software: PyCharm
|
|
@contact: t6g888@163.com
|
|
@file: data_loader
|
|
@date: 2026/1/27 10:00
|
|
@desc: 数据加载工具
|
|
"""
|
|
import yaml
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
|
|
def load_yaml(file_path: Path | str) -> dict[str, Any] | list[Any]:
|
|
"""
|
|
加载 YAML 文件
|
|
:param file_path: 文件路径
|
|
:return: 数据字典或列表
|
|
"""
|
|
path = Path(file_path)
|
|
if not path.exists():
|
|
raise FileNotFoundError(f"YAML file not found: {path}")
|
|
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
return yaml.safe_load(f)
|