mirror of https://gitee.com/a529548204/apitest.git
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# coding:utf-8
|
|
import os
|
|
|
|
import yaml
|
|
|
|
from config.confManage import dir_manage
|
|
from util.scripts import root_path
|
|
from util.tools.getFileNames import getFilePathList
|
|
|
|
datapath = root_path + dir_manage("${test_suite}$") + dir_manage("${data_dir}$") + "/" + dir_manage("${test_name}$")
|
|
|
|
|
|
def ini_yaml():
|
|
alldata = {}
|
|
datalist = getFilePathList(datapath,".yml")
|
|
for file in datalist:
|
|
try:
|
|
with open(file, 'r', encoding="utf-8") as f:
|
|
file_data = f.read()
|
|
alldata= {**alldata,**yaml.safe_load(file_data)}
|
|
except UnicodeDecodeError:
|
|
with open(file, 'r') as f:
|
|
file_data = f.read()
|
|
alldata= {**alldata,**yaml.safe_load(file_data)}
|
|
print("*"*200)
|
|
return alldata
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# print(datapath)
|
|
# get_yaml_data(r"F:\api2.0\config\runConfig.yml")
|
|
d = ini_yaml()
|
|
print(d)
|
|
# # case_level = runConfig_dict[0]["address"].format(**{"home_id": "123"})
|
|
# print(runConfig_dict)
|
|
|
|
# print(case_level)
|
|
# print(type(case_level))
|