- .github/workflows/ci.yml: CI 流水线 - 触发器: push / pull_request 到 main - 矩阵: Python 3.10 / 3.11 / 3.12 - fail-fast: false(单版本失败不影响其他) - concurrency: 取消同分支旧运行 - steps: checkout / setup-python / pip cache / 安装依赖 / 运行 pytest+coverage / 上传 coverage 产物 - pytest.ini: 统一测试发现(tests + data/*/tests),与 CI 行为一致 - requirements-dev.txt: 测试依赖最小集(pytest / pytest-cov / pytest-timeout / pytest-xdist) - README.md: 顶部增加 CI 状态徽章 - .gitignore: 忽略 .coverage.* / coverage.xml 覆盖率硬门槛(--cov-fail-under)留待 T5.5,避免在 T10.1 阶段被尚未补齐的脚本/分享模块测试阻断。 本任务产出 coverage.xml 供 T10.2 codecov 集成使用。
13 lines
308 B
INI
13 lines
308 B
INI
[pytest]
|
||
# 统一的测试发现规则(本地与 CI 行为一致)
|
||
testpaths = tests data
|
||
python_files = test_*.py *_test.py
|
||
python_classes = Test*
|
||
python_functions = test_*
|
||
|
||
# 输出
|
||
addopts = -ra --strict-markers --tb=short
|
||
|
||
# 超时:单个测试 30s(防止 CI 因卡死浪费资源)
|
||
timeout = 30
|