[pytest] # 测试发现配置 testpaths = tests python_files = test_*.py python_classes = Test* python_functions = test_* # 输出格式 addopts = -v --tb=short --cov=backend --cov-report=term-missing --cov-report=html:htmlcov # 覆盖率红线 60→70 棘轮(测试体系评估 P1-1):2026-10-15 实测整体 80.92%、 # watermark.py 86% 后同批抬升;未达标不得抬(诚实铁律)。 --cov-fail-under=70 --benchmark-autosave --basetemp=pytest_tmp --ignore=tests/node_modules --ignore=tests/frontend/_rendered # 测试副产物滚动清理(2026-09-25):显式 --basetemp 的会话残留由 tests/conftest.py # 的 pytest_sessionfinish 调 scripts/prune_test_artifacts.py 回收(keep=3;pytest 仅 # 在下轮开始时无差别 rm_rf 全清,且 Windows 持锁项会静默存活)。 # 下面两项仅对未传 --basetemp 的场景生效(pytest 自动目录轮转),防跨会话堆积。 tmp_path_retention_count = 2 tmp_path_retention_policy = failed # 过滤器 filterwarnings = ignore::DeprecationWarning ignore::PendingDeprecationWarning # 标记 markers = slow: marks tests as slow (deselect with '-m "not slow"') integration: marks tests as integration tests smoke: marks tests as smoke tests security: marks security-related tests (integrity/watermark/license/hash) — 安全合规落地 P2-5