Check that every test function asserts something
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 18
- Forks
- 33
- Ø Merge
- 2 T. 21 Std.
- Gemergte PRs (30 T.)
- 93
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PolicyEngine/policyengine-api
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
PolicyEngine/policyengine-api#4037 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
PolicyEngine/policyengine-api#3911 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
PolicyEngine/policyengine-api#3910 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Assign every v2 route and service file to a layer and enforce the doc-only v2 layer rulesEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offenenhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
PolicyEngine/policyengine-api#4190 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Check that every noqa and type: ignore comment names a code and gives a reasonEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 20/100
PolicyEngine/policyengine-api#4182 ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in PolicyEngine/policyengine-api
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
jejjohnson/gaussx#752 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
521xueweihan/HelloGitHub#4270 ·
-
enhancement owner: den-haag
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
Maintainer antworten meist innerhalb von 6 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ok-oldking/ok-wuthering-waves#1828 ·
Maintainer antworten meist innerhalb von 1 Tag
-
lesson-submission pending-review
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
Ikalus1988/MisakaNet#4512 ·
Maintainer antworten meist innerhalb von 1 Tag