Files
fluent_widgets_pyside6/tests/common.py

18 lines
489 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.

import sys
import os
# 注意: 只在 tests 目录下的 测试文件中使用
# 设置项目目录 为搜索目录
# 通用逻辑:添加项目根目录到搜索路径
def add_project_root_to_path():
# 获取项目根目录tests的上级目录
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
sys.path.append(project_root)
# 自动执行(导入时就添加路径)
add_project_root_to_path()