接口测试系列:工作中所用(三:__read_config.py文件)

import os
from common import fileUtil

def __read_config():
    base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    settings_file = os.path.join(os.path.join(os.path.realpath(base_dir), "config"),
                                 "settings.yml")
    db_file = os.path.join(os.path.join(os.path.realpath(base_dir), "config"), "db.yml")
    print(settings_file)
    settings = fileUtil().connect_to(settings_file).parsed_data
    db = fileUtil().connect_to(db_file).parsed_data
    ENV = settings["env"]
    source = settings["source"]
    return ENV, db, source, settings
ENV, DB, dbc, settings = __read_config()

  

转载于:https://www.cnblogs.com/by170628/p/9816120.html

你可能感兴趣的:(接口测试系列:工作中所用(三:__read_config.py文件))