testsAndMisc/docs/superpowers/evidence/wsg-grabber-test-review-split-2026-08-16.json
Krzysztof kuhy Rudnicki e03fbd17e9 Split wsg_grabber/tests/test_review.py under the 250-line cap
Split along the same seams the source took: test_review_render.py covers what
now lives in review._render, test_review_undo.py covers review._undo.

The two fixture builders they share moved into the existing conftest.py rather
than a _helpers.py -- the name-tests-test hook requires everything else under
tests/ to be named test_*.py, and syncyomi_guard/tests/conftest.py is the
precedent for plain shared builders living there. Sharing beats copying: jscpd
fails the commit above 2% duplication and this repo already carries four partN
test files.

277 passed, the same count as before, so nothing was dropped. Two intermediate
runs caught real NameErrors from imports the extracted module needed.

test_review.py 297 -> 112, test_review_render.py 102, test_review_undo.py 79.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-16 16:24:48 +02:00

37 lines
2.7 KiB
JSON

{
"intent": "Bring python_pkg/wsg_grabber/tests/test_review.py under the 250-line file cap by splitting it along the same seams the source module was split on, keeping the test count identical.",
"scope": [
"python_pkg/wsg_grabber/tests/test_review.py",
"python_pkg/wsg_grabber/tests/test_review_render.py (new)",
"python_pkg/wsg_grabber/tests/test_review_undo.py (new)",
"python_pkg/wsg_grabber/tests/conftest.py",
"Non-goal: no assertion changes, no test removed or weakened"
],
"changes": [
"Moved the rendering tests (emptiness, status_line, filename_line, title_line, render) into test_review_render.py, mirroring the source split into review._render.",
"Moved the undo tests into test_review_undo.py, mirroring review._undo.",
"Moved the two shared fixture builders _item and _reviewed into the existing conftest.py as item/reviewed, and imported them from the three test modules. Sharing them rather than copying keeps jscpd's 2% duplication gate happy.",
"test_review.py 297 -> 112 lines; test_review_render.py 102; test_review_undo.py 79; conftest.py 91."
],
"verification": [
{
"command": "python3 -m pytest python_pkg/wsg_grabber/tests/ -q",
"result": "pass",
"evidence": "277 passed in 15.16s -- exactly the count before the split, so no test was dropped or silently skipped by the move. Two intermediate runs failed first (4 failed, then 1 failed) because the extracted module was missing model imports and Path; those were real NameErrors surfaced by running the suite, fixed, and re-verified."
},
{
"command": "pre-commit run --files python_pkg/wsg_grabber/tests/test_review.py python_pkg/wsg_grabber/tests/test_review_render.py python_pkg/wsg_grabber/tests/test_review_undo.py python_pkg/wsg_grabber/tests/conftest.py",
"result": "pass",
"evidence": "All quality hooks pass; only the evidence and contract artifact hooks remained, which this file and the paired contract satisfy."
}
],
"risks": [
"The shared builders went into conftest.py rather than a _helpers.py because the name-tests-test hook requires every other file under tests/ to match test_*.py. A _helpers.py was written first and rejected by that hook; python_pkg/syncyomi_guard/tests/conftest.py is the existing precedent for plain shared builders living in conftest.",
"conftest.py now mixes autouse path isolation with fixture builders. The module docstring says so explicitly."
],
"rollback": [
"git revert the commit; test_review.py returns to its 297-line form, the two new modules are deleted and conftest.py loses the builders.",
"After rollback, run python3 -m pytest python_pkg/wsg_grabber/tests/ -q and confirm it still reports 277 passed."
]
}