"""公共设施包的 pytest 配置(仅测试进程级隔离,不注册 autouse fixture)。 由于 `wov_app.config` 在导入时锁定路径常量,这里在 pytest 启动早期把应用 数据目录指向进程级临时目录,避免任何测试写入真实 `data/`。该配置属于 `tests/shared/` 包本身,不构成"模块测试依赖外部配置":模块目录内的用例 如需自己的临时目录,仍在模块 fixture 中用 `env_isolation` 显式创建。 """ from __future__ import annotations import atexit from tests.shared import env_isolation # 进程启动即隔离,保证后续任何 import wov_app.config 都拿到测试路径。 _ROOT = env_isolation.configure_environment() # 进程退出时清理临时目录。 atexit.register(env_isolation.cleanup_data_root, _ROOT)