fix(data): Task 1 review 修复(pycache清理+pytest.ini+错误处理)
- Fix 1: 移除误 commit 的 __pycache__ 文件 - Fix 2: 创建 pytest.ini 解决 PYTHONPATH 问题 - Fix 3: load_config 添加错误处理(FileNotFoundError + ValueError) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
# tests/data/test_config.py
|
||||
import pytest
|
||||
from sanguo_data.config import load_config, DataConfig
|
||||
|
||||
def test_load_config_returns_dataconfig(tmp_path):
|
||||
@@ -25,3 +26,7 @@ performance:
|
||||
assert cfg.data_paths["daily_dir"] == "/tmp/daily"
|
||||
assert cfg.data_sources["daily"][0]["name"] == "eastmoney"
|
||||
assert cfg.performance["max_retries"] == 3
|
||||
|
||||
def test_load_config_raises_on_missing_file():
|
||||
with pytest.raises(FileNotFoundError, match="配置文件不存在"):
|
||||
load_config("/nonexistent/path/config.yaml")
|
||||
|
||||
Reference in New Issue
Block a user