feat: + Config.options

This commit is contained in:
莘权 马 2023-08-20 10:19:43 +08:00
parent f31b60309a
commit 291af5ad01
2 changed files with 29 additions and 9 deletions

View file

@ -4,7 +4,9 @@
@Time : 2023/5/1 11:19
@Author : alexanderwu
@File : test_config.py
@Modified By: mashenquan, 2013/8/20, add `test_options`
"""
from pathlib import Path
import pytest
@ -29,3 +31,14 @@ def test_config_yaml_file_not_exists():
with pytest.raises(Exception) as exc_info:
config.get('OPENAI_BASE_URL')
assert str(exc_info.value) == "Key 'OPENAI_BASE_URL' not found in environment variables or in the YAML file"
def test_options():
filename = Path(__file__).resolve().parent.parent.parent.parent / "config/config.yaml"
config = Config(filename)
opts = config.options
assert opts
if __name__ == '__main__':
test_options()