Files
xiaoxia-saas/pytest.ini
CI Bot d8523875b2
CI/CD Pipeline / Frontend Lint (push) Successful in 1m24s
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 1m24s
CI/CD Pipeline / Build Production Runtime Images (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 1m22s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m45s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Successful in 2m49s
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
feat(test): P0级测试质量体系 - 环境变量清单 + 覆盖率门禁
## 改造内容

### 1. CI环境变量清单 (docs/ci-env-vars.md)
- 全面扫描后端代码,整理所有环境变量配置
- 分类:CI必需(P0)、可选(有默认值)、测试专用、Worker服务专用
- 明确当前CI已配置的变量及缺失项
- 附环境变量读取位置索引,便于后续维护

### 2. 测试覆盖率门禁
- 单元测试:收集覆盖率数据(apps/目录)
- 集成测试:追加覆盖率 + 50%最低门槛门禁
- 输出格式:term + xml(cobertura格式)
- 初始门槛设为50%,后续逐步提升
- pytest-cov 已在 requirements-dev.txt 中,无需新增依赖

## 收益
- 环境变量管理透明化,便于CI配置排查
- 覆盖率可视化,量化测试质量
- 门禁机制防止代码质量回退
2026-07-09 15:25:28 +08:00

9 lines
339 B
INI

[pytest]
pythonpath = . apps/api apps/worker
testpaths = tests
# ===== 覆盖率配置 =====
# 覆盖率统计范围(供 --cov 使用时的默认源)
# 注意:addopts 不默认开启 --cov,避免影响本地开发调试
# CI 中通过命令行参数显式开启:--cov=apps --cov-report=term --cov-report=xml --cov-fail-under=50