fault-log-analyzer/tests/_bootstrap.py

15 lines
465 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.

"""测试引导模块。
将 ``src`` 目录加入 ``sys.path``,使 ``python -m unittest discover -s tests -v``
在未安装包的情况下也能直接运行src-layout 项目无需额外设置 PYTHONPATH
每个测试模块顶部 ``import _bootstrap`` 即可。
"""
from __future__ import annotations
import os
import sys
_SRC = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "src")
if _SRC not in sys.path:
sys.path.insert(0, _SRC)