[pytest]
# Test the checkout rather than an installed package.
# st_test 下是黑盒 ST(独立契约 + workswarm 兼容),不随 tests 默认收集。
pythonpath = . st_test

# Pytest configuration file

# Test discovery patterns
python_files = test_*.py *_test.py
python_classes = Test*
python_functions = test_*

# Test paths
testpaths = tests

# Output options
addopts =
    -v
    --strict-markers
    --tb=short
    --cov=agent_gateway
    --cov-report=term-missing
    --cov-report=html
    --cov-report=xml
    --asyncio-mode=auto

# Markers
markers =
    unit: Unit tests
    integration: Integration tests
    system: System tests
    slow: Slow running tests
    async: Async tests

# Logging
log_cli = true
log_cli_level = INFO
log_cli_format = %(asctime)s [%(levelname)s] %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S

# Warnings
filterwarnings =
    error
    ignore::DeprecationWarning
    # pysbd 0.3.4(PyPI 最新)在 3.12+ 触发 SyntaxWarning(invalid escape sequence);
    # 该告警会中断 core 检索链的导入并留下半初始化的全局状态,进而污染后续用例。
    # 3.11 上同类告警是 DeprecationWarning,已被上面的规则忽略。
    ignore:invalid escape sequence:SyntaxWarning
    # uvicorn>=0.54 在导入 websockets 实现时告警,与 gateway 行为无关。
    # 用 module 过滤而非 UvicornDeprecationWarning 类:旧版 uvicorn 没有该类,
    # 直接引用会让 pytest 在解析配置时 AttributeError(与 workswarm 共环境时会踩到);
    # module 必须写实际抛出告警的模块(websockets_impl),config 模块只定义异常类。
    ignore::UserWarning:uvicorn.protocols.websockets.websockets_impl
    ignore::PendingDeprecationWarning
    ignore::ResourceWarning
    ignore::pytest.PytestUnraisableExceptionWarning