xiaozhi-esp32-server/main/xiaozhi-server/tests/conftest.py

11 lines
No EOL
394 B
Python

"""Pytest configuration — must run BEFORE any test imports project modules.
Adds the xiaozhi-server directory to sys.path so the existing implicit
relative imports (`from core.utils.textUtils import ...`) resolve.
"""
import sys
from pathlib import Path
_PROJECT_ROOT = Path(__file__).resolve().parent.parent
if str(_PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(_PROJECT_ROOT))