auto_test_dev/configs/globalParams.py

43 lines
1.9 KiB
Python

# !/usr/bin/python
# -*- coding: utf-8 -*-
import os,datetime,time
from datetime import datetime,timedelta
from commons.FileHandler import YamlHandler as yam
from commons.SignatureYM import SignatureYM
__RootPath = os.path.dirname(os.path.dirname(__file__)).replace("\\", "/")
__YamlFilePath = os.path.join(__RootPath, "configs/Configs.yaml").replace("\\", "/")
ProCfgData = yam().read_yaml(__YamlFilePath)
HEADERS = SignatureYM().return_headers()
GlobalPath = {
"CfgPath": os.path.join(__RootPath, 'configs').replace("\\", "/"),
"YMDataPath": os.path.join(__RootPath, 'YiMao/data').replace("\\", "/"),
"YMCfgPath": os.path.join(__RootPath, 'YiMao/config').replace("\\", "/"),
"YMService": os.path.join(__RootPath, 'YiMao/scripts/YMService').replace("\\", "/"),
"YMClient": os.path.join(__RootPath, 'YiMao/scripts/YMClient').replace("\\", "/"),
"YMBusiScenarios": os.path.join(__RootPath, 'YiMao/scripts/BusiScenarios').replace("\\", "/"),
"YMReportPath": os.path.join(__RootPath, 'YiMao/report').replace("\\", "/")
}
GlobalParams = {
"timeStamp": int(time.time()),
"todayDate": time.strftime('%Y-%m-%d'),
"todayDateDel1": (datetime.now() + timedelta(days=-1)).strftime('%Y-%m-%d'),
"todayDateAdd1": (datetime.now() + timedelta(days=1)).strftime('%Y-%m-%d'),
"todayDateAdd2": (datetime.now() + timedelta(days=2)).strftime('%Y-%m-%d'),
"todayDateAdd3": (datetime.now() + timedelta(days=3)).strftime('%Y-%m-%d'),
"todayDateAdd4": (datetime.now() + timedelta(days=4)).strftime('%Y-%m-%d'),
"todayDateAdd5": (datetime.now() + timedelta(days=5)).strftime('%Y-%m-%d'),
}
def __data_init():
DataList = []
for fn in ProCfgData["MarketsArray"]:
FP = os.path.join(GlobalPath["YMDataPath"], fn+".yaml").replace("\\", "/")
data = yam().read_yaml(FP)
DataList.append(data)
return DataList
DataInit = __data_init()