完成渠道模块的单元测试目录搭建,新增多个领域模型、端口、中间件、事件、服务以及基础设施层的单元测试文件,同时补充了conftest.py的环境变量配置,完善测试基础环境。
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
# Avoid package-level knowledge graph initialization during pytest collection.
|
|
os.environ.setdefault("YUXI_SKIP_APP_INIT", "1")
|
|
os.environ.setdefault("OPENAI_API_KEY", "sk-test-fake")
|
|
|
|
|
|
def pytest_configure(config: pytest.Config) -> None:
|
|
"""Register shared markers without binding every test to a live environment."""
|
|
config.addinivalue_line("markers", "unit: marks tests that run without live services")
|
|
config.addinivalue_line("markers", "auth: marks tests that require authentication")
|
|
config.addinivalue_line("markers", "integration: marks tests that hit the live API service")
|
|
config.addinivalue_line("markers", "e2e: marks tests that exercise an end-to-end workflow")
|
|
config.addinivalue_line("markers", "slow: marks tests as slow")
|
|
|
|
|
|
pytest_plugins = ["pytest_asyncio"]
|