test_utils.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:charm-heat 作者: openstack 项目源码 文件源码
def load_config():
    """Loads config.
    Walk backwords from __file__ looking for config.yaml, load and return the
    'options' section'
    """
    config = None
    f = __file__
    while config is None:
        d = os.path.dirname(f)
        if os.path.isfile(os.path.join(d, 'config.yaml')):
            config = os.path.join(d, 'config.yaml')
            break
        f = d

    if not config:
        logging.error('Could not find config.yaml in any parent directory '
                      'of %s. ' % file)
        raise Exception

    return yaml.safe_load(open(config).read())['options']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号