"""pytest 配置:将项目根目录加入 Python 路径""" import os import sys # 确保项目根目录在 Python 路径中,使所有模块可以用裸 import sys.path.insert(0, os.path.dirname(__file__))