Check that every test function asserts something
维护者通常 2 天内回复
评估
调研方向
Read step 2.7 of the code-quality plan and inspect rules/registry.toml for how ratcheted rules are registered. Then review existing rule implementations, tests under scripts/rules/tests/, and the 22 baseline cases described in the issue. Done means the rule detects the listed assertion forms and helper calls, records current exceptions in a baseline under rules/baselines/, and the baseline can only shrink; pull request #4188 is already open.
由索引模型根据 Issue 内容生成。
描述
What
Add a quality guard that fails on any test function that checks nothing: one that contains no assert, no pytest.raises (or pytest.warns, pytest.fail), no unittest self.assert... or self.fail, no mock assert_called... or other call to an assert... function, no raise AssertionError, and no call to a helper that does one of these. Today's tests that check nothing go in a baseline file under rules/baselines/, which can only shrink.
Why
A test without a check passes whatever the code returns, as long as nothing raises. Of the 3,013 test functions in tests/ and scripts/rules/tests/, 22 check nothing today, for example tests/unit/test_warmup.py::test_run_startup_warmup_swallows_calculate_errors. Most of these only show that a call doesn't raise. They pass even if the call returns the wrong value.
This is the "every test function asserts something" check in step 2.7 of the code-quality plan, registered in rules/registry.toml as a ratcheted rule.
- 主要语言
- Python
- 星标
- 18
- 派生
- 33
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 93
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PolicyEngine/policyengine-api 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
PolicyEngine/policyengine-api#4037 ·
维护者通常 2 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
PolicyEngine/policyengine-api#3911 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
维护者通常 2 天内回复
-
Assign every v2 route and service file to a layer and enforce the doc-only v2 layer rules可能已有人在做 @anth-volk 于 1 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 20/100
PolicyEngine/policyengine-api#4190 ·
维护者通常 2 天内回复
-
Check that every noqa and type: ignore comment names a code and gives a reason可能已有人在做 @anth-volk 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 20/100
PolicyEngine/policyengine-api#4182 ·
维护者通常 2 天内回复
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
its-me-prash/vwgroup-connect-ha#2019 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
KonstantinStarovoytov/kitden#21 ·
维护者通常 1 天内回复
-
Refactor未关闭
难度 2/5 1-3 小时 新手友好度 62/100
ehmatthes/gh-profiler#166 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
smart-on-fhir/smart-fetch#73 ·
-
good first issue help wanted
难度 1/5 1-3 小时 新手友好度 85/100
RizgarOzan/playcal#13 ·