test: 补齐覆盖率工具(pytest-cov,fail_under=90,基线 96.67%)

This commit is contained in:
lhl
2026-08-09 04:32:11 +08:00
parent ba092f2df7
commit 737911cf25
3 changed files with 78 additions and 2 deletions
+17 -2
View File
@@ -16,10 +16,25 @@ dependencies = [
]
[project.optional-dependencies]
dev = ["pytest>=8.0"]
dev = ["pytest>=8.0", "pytest-cov>=7.0"]
[tool.setuptools.packages.find]
where = ["src"]
[tool.pytest.ini_options]
testpaths = ["tests"]
testpaths = ["tests"]
addopts = "--cov=genesis --cov-report=term-missing"
[tool.coverage.run]
# 仅统计 src/genesis 业务代码(不含 tests 自身)
source = ["genesis"]
# 测量分支覆盖
branch = true
[tool.coverage.report]
# 覆盖率门槛:低于该值 pytest 失败(红线,防止回归)
fail_under = 90
# 跳过 __init__.py 等空文件干扰
skip_empty = true
# 按语句总数降序展示
sort = "miss"