Repository navigation
test(audit): pin the duplicate identity, nested test files, the exempt suffix and raises - #232
Conversation
…t suffix and raises In the intel#103 review these parts of the test-quality gate could change with the gate's own tests green, and the review agreed to pin them in a follow-up: - each part of a test's signature in the duplicate identity: keyword-only and positional-only parameters, keyword-only defaults, `*args` and `**kwargs`; - `rglob` for both file patterns in `audit_tree`, so a test file in a subdirectory is audited; - the `(exempt)` suffix in the report, on an exempt test only; - `mock_echo` skipping a patched test that expects a raise. Each of the 10 mutants (one part of the identity dropped, `glob` for either pattern, the suffix never or always printed, `not t.raises` dropped) passed the gate's tests and now fails one. Test-only change. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #232 +/- ##
==========================================
- Coverage 92.25% 92.24% -0.01%
==========================================
Files 239 239
Lines 29937 29937
Branches 4918 4918
==========================================
- Hits 27618 27616 -2
- Misses 1632 1633 +1
- Partials 687 688 +1 🚀 New features to boost your workflow:
|
|
@exai-bot /review |
exai-bot
left a comment
There was a problem hiding this comment.
Note
AI-generated review of 537be6742dde, requested by @antonwolfy, using the default review skill. It can be wrong: verify a finding before acting on it. React with a thumbs up or down on a finding to tell the bot whether it helped.
Model us.anthropic.claude-sonnet-5-5, effort default, 5 of 80 turns, 0.4 of 40 minutes, 59k in / 2k out tokens.
This PR only adds tests to test_audit_test_quality.py. They cover the duplicate identity (keyword-only and positional-only fixtures, keyword-only defaults, *args, **kwargs), nested test files, the (exempt) report suffix, and not t.raises in mock_echo. I read each new case against scripts/audit_test_quality.py (_duplicates, audit_tree, report, mock_echo). Each one would fail under the mutant it targets, and none looks vacuous. I found no defects. I could not run pytest here because it can't be installed in the sandbox.
No issues found.
Not verified
I did not run the test file or the 10 mutants. Their results rest on my reading of the code and on the PR's description.
There was a problem hiding this comment.
🟢 Approval recommended
The isolated test-only changes cover the intended auditor behavior, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Adds regression coverage for the test-quality auditor introduced in #103, without changing production code or auditor behavior.
Changes:
- Covers five signature differences that must prevent duplicate-test flags.
- Verifies recursive discovery for both test-file naming patterns.
- Checks exemption suffixes in reports and ensures expected exceptions prevent
mock_echoflags.
| File | Description |
|---|---|
dokimi/tests/test_audit_test_quality.py |
Adds focused regression cases for duplicate identity, nested discovery, reporting, and exception assertions. |
Review effort: Balanced
napetrov
left a comment
There was a problem hiding this comment.
Review of 537be67.
Summary: tests only. The new cases for the duplicate identity (keyword-only and positional-only fixtures, keyword-only defaults, *args, **kwargs), nested test files, the (exempt) suffix and not t.raises match what the PR body says they pin. No fixes pushed.
Test evidence (local, on 537be67):
uv run pytest dokimi/tests/test_audit_test_quality.py: 141 passed.ruff checkon the touched file: clean.- The audit of the repo's own tests is unchanged: only the existing exempt test is reported.
Open items: none. As the body says, #231 edits the same file. Whichever lands second should be rerun against the other.
Verdict: ready from my side.
vchamarthi
left a comment
There was a problem hiding this comment.
Tests match the auditor's current behavior at the head; no issues found.
intel#232 also edits tests/test_audit_test_quality.py; the merge is clean and the gate's tests pass with both. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Summary
Follow-up to the review of #103 (thread). napetrov fixed part of my non-blocking point and left the rest for a follow-up, which I agreed to. On
main, each mutant ofscripts/audit_test_quality.pybelow passes all 133 tests of the gate's test file. Only tests change.Changes
tests/test_audit_test_quality.py:test_a_body_with_other_inputs_is_not_a_duplicategets five pairs of tests whose signatures differ in only one way: keyword-only fixtures, positional-only fixtures, keyword-only defaults,*argsor**kwargs. Dropping any of those parts from the duplicate identity (_duplicates) passed before.test_every_file_pytest_collects_is_auditedalso runs with the files two levels down, soglobinstead ofrglobfor either pattern inaudit_treefails it.test_the_report_marks_only_an_exempt_test_as_exempt:report()printing the(exempt)suffix never, or always, passed before.test_a_patched_test_that_expects_a_raise_is_not_a_mock_echo: napetrov also listed three single-flag mutants. Droppingnot t.raisesfrommock_echostill passed. The other two,_is_weakwithanyover everyBoolOpandtype_onlyignoringassert_*calls, already fail a test onmain.Risk
None: tests only, so no changelog fragment. #231 edits the same test file in other places; the two branches merge cleanly.
Testing
On a Linux review host, at
537be67(onmain54ce188):make ci-local: 29 passed, 0 failed, 7 skipped (the Docker catalog smoke,test-latest, thecli-surfacepackaging step, conda-forge-deps without micromamba, docsdeploy, the pip-audit report, semgrep). 8,208 tests passed, 2 skipped.scripts/audit_test_quality.pyfails one test of the file:kw_defaults,vararg,kwarg,kwonlyargsorposonlyargsdropped from the identity;globfortest_*.pyor for*_test.py; the suffix never or always printed;not t.raisesdropped frommock_echo. Onmainall 10 pass its 133 tests.main54ce188 (0a5717c): the full suite (8,232 passed, 2 skipped), the growth check,mypyandruffpass.Checklist
pytestpassesruff,mypy, and schema checks pass.github/.licenserc.yaml)