feat(core,utils): 新增CoreDriver基础操作,更新文档
- 新增 switch_to_webview/switch_to_native 切换视图。 - 新增 config_loader.py 配置文件系统 - 优化 conftest.py,支持获取设备信息和默认参数。 - 优化 run_appium.py - 更新 README.md - 其他优化
This commit is contained in:
28
utils/data_loader.py
Normal file
28
utils/data_loader.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/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, List
|
||||
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user