Files
life-echo/api/tests/conftest.py

16 lines
811 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Pytest 配置:确保 api 目录在 path 中,并预先加载所有 model 以解析 relationship 字符串引用。"""
import sys
from pathlib import Path
_api_dir = Path(__file__).resolve().parent.parent
if str(_api_dir) not in sys.path:
sys.path.insert(0, str(_api_dir))
# 聚合导入所有 feature models使 SQLAlchemy 能解析 User -> Order 等字符串 relationship
from app.features.auth import models as _auth_models # noqa: F401
from app.features.conversation import models as _conv_models # noqa: F401
from app.features.memory import models as _memory_models # noqa: F401
from app.features.memoir import models as _memoir_models # noqa: F401
from app.features.payment import models as _payment_models # noqa: F401
from app.features.user import models as _user_models # noqa: F401