PhoneWork/conftest.py
Yuyao Huang (Sam) 8dab229aaf feat: 添加测试框架及功能测试用例
test: 实现BDD测试框架及功能测试
docs: 添加测试配置文件及文档
refactor: 重构命令处理逻辑以支持测试
2026-03-29 04:24:27 +08:00

17 lines
564 B
Python

"""
Root conftest — runs before pytest collects any test files or imports any
production modules. Patches config._CONFIG_PATH to point at the test keyring
so that `import config` never tries to open the real keyring.yaml.
Must live at the repo root (not inside tests/) to fire before collection.
"""
from pathlib import Path
import importlib
_TEST_KEYRING = Path(__file__).parent / "tests" / "keyring_test.yaml"
# Patch config before anything else imports it
import config as _config_mod
_config_mod._CONFIG_PATH = _TEST_KEYRING
importlib.reload(_config_mod)