mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 20:54:00 +01:00
test_cups_queue.py 458 -> 167, partitioned at class boundaries into _actions (the four shell-out primitives) and _backend (health check and error-log scanning). test_cups_queue_part2.py 278 -> 131, with the four _handle_* dispatchers moving to _handlers. No MOD changed: unlike the source splits, every patched name already lives in the module each file names, so this is a pure partition. The two part-numbered survivors are renamed for what they cover. Pass count is 402 before and after. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
44 lines
3.3 KiB
JSON
44 lines
3.3 KiB
JSON
{
|
|
"intent": "Bring the two over-cap cups_queue test modules under the 250-line cap by partitioning them by test class, with no change to what is tested.",
|
|
"scope": [
|
|
"python_pkg/brother_printer/tests/test_cups_queue.py (458 -> 167)",
|
|
"python_pkg/brother_printer/tests/test_cups_queue_actions.py, test_cups_queue_backend.py (new)",
|
|
"python_pkg/brother_printer/tests/test_cups_queue_part2.py -> test_cups_queue_menu.py (278 -> 131)",
|
|
"python_pkg/brother_printer/tests/test_cups_queue_handlers.py (new)",
|
|
"python_pkg/brother_printer/tests/test_cups_queue_part3.py -> test_cups_queue_display.py (rename only)",
|
|
"Non-goal: no assertion changed, no test deleted, skipped or weakened"
|
|
],
|
|
"changes": [
|
|
"test_cups_queue.py split three ways at class boundaries: the lpstat parsing and get_cups_queue_status tests stay, the four _cups_* action primitives go to test_cups_queue_actions.py, and the health check plus backend-error log scanning go to test_cups_queue_backend.py.",
|
|
"test_cups_queue_part2.py split at TestHandleDisabledWithJobs: the menu and the five _dwj_* choices stay, the four _handle_* dispatchers go to test_cups_queue_handlers.py.",
|
|
"No MOD constant changed anywhere in this commit. Unlike the source splits, every patched name already lives in the module each file names, so this is a pure partition of test classes.",
|
|
"Import blocks trimmed to what each file uses: the original lost eight now-unmoved names and StringIO, the backend file needed subprocess added for its TimeoutExpired cases, and the handlers file needed CUPSJob. test_cups_queue_part2.py dropped its four _handle_* imports but keeps patching them by string, since _offer_queue_fix dispatches to them.",
|
|
"Renamed the two part-numbered survivors to test_cups_queue_menu.py and test_cups_queue_display.py so the file name says which concern it covers."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "PYTHONPATH=. python3 -m pytest python_pkg/brother_printer/tests -q",
|
|
"result": "pass",
|
|
"evidence": "402 passed before the split and 402 passed after it - identical pass count. This is the check that matters here: a partition that dropped a whole class would still report a green run."
|
|
},
|
|
{
|
|
"command": "wc -l python_pkg/brother_printer/tests/test_cups_queue*.py",
|
|
"result": "pass",
|
|
"evidence": "167, 157, 164, 161, 131 and 76 lines - all six modules under the 250-line cap."
|
|
},
|
|
{
|
|
"command": "pre-commit run --files <the touched test files and artifacts>",
|
|
"result": "pass",
|
|
"evidence": "ruff, ruff format, mypy, pylint, bandit, name-tests-test and pytest-with-coverage all pass."
|
|
}
|
|
],
|
|
"risks": [
|
|
"Trimming import blocks by hand can remove a name that is only reachable at runtime. Guarded by the pass count plus ruff's F401 sweep, and by checking whether each dropped name was still patched by string rather than imported.",
|
|
"No shared conftest.py was introduced; if a later split of the remaining test modules needs the same fixture scaffolding, it belongs in tests/conftest.py rather than a fourth copy, to keep jscpd under its 2% duplication threshold."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; the two originals return at 458 and 278 lines and the three new modules disappear.",
|
|
"After rollback, re-run the package suite and confirm it still reports 402 passed."
|
|
]
|
|
}
|