Cut the test fixtures' and fakes' comments to their reasons #74

Merged
Claude merged 2 commits from docs/test-fixture-comments into feat/firmware-updates 2026-09-20 07:06:05 +00:00
Collaborator

The last of the comment pass, held back until the five over the rest of the
repository had landed. Comment and docstring lines across the two files go from
155 to 111.

What went: docstrings on POLL_SECONDS and GIVE_UP_AFTER that only re-spelt
their names, reassurance that the real servers are tested elsewhere, and a lot
of padding around reasons that survive in a shorter form.

What stayed: why each autouse fixture refuses rather than fakes, that
aioclient_mock is what gets the real updater client back, that the fetch stop
leaks between tests, that the real file server would otherwise bind every
interface on the machine running the suite, and the three waiting traps in
fakes.py — the executor sleep under a frozen clock, watched as a
loop-turn-safe signal, and _background_tasks over asyncio.all_tasks.

No behaviour change and no fixture weakened; no renames, so no other test file
is touched. Full suite green at 1087 passed, plus ruff check, ruff format and
mypy.

The last of the comment pass, held back until the five over the rest of the repository had landed. Comment and docstring lines across the two files go from 155 to 111. What went: docstrings on `POLL_SECONDS` and `GIVE_UP_AFTER` that only re-spelt their names, reassurance that the real servers are tested elsewhere, and a lot of padding around reasons that survive in a shorter form. What stayed: why each autouse fixture refuses rather than fakes, that `aioclient_mock` is what gets the real updater client back, that the fetch stop leaks between tests, that the real file server would otherwise bind every interface on the machine running the suite, and the three waiting traps in `fakes.py` — the executor sleep under a frozen clock, `watched` as a loop-turn-safe signal, and `_background_tasks` over `asyncio.all_tasks`. No behaviour change and no fixture weakened; no renames, so no other test file is touched. Full suite green at 1087 passed, plus ruff check, ruff format and mypy.
Cut the test fixtures' and fakes' comments to their reasons
All checks were successful
Lint, type check and test / hassfest (pull_request) Successful in 7s
Lint, type check and test / quality (pull_request) Successful in 4m46s
Lint, type check and test / release (pull_request) Has been skipped
238d603e5c
Claude left a comment

Three small things; no behaviour change and nothing outside the two files. Every surviving claim I checked holds: the harness really does block socket.socket (pytest_socket.disable_socket in the plugin), aioclient_mock really is the opt-out, service.py really sets the module FETCH_STOP on the way out, and the supervisor really is a background task that never finishes.

Three small things; no behaviour change and nothing outside the two files. Every surviving claim I checked holds: the harness really does block `socket.socket` (`pytest_socket.disable_socket` in the plugin), `aioclient_mock` really is the opt-out, `service.py` really sets the module `FETCH_STOP` on the way out, and the supervisor really is a background task that never finishes.
@ -75,2 +64,2 @@
to keep running without, so a test that does not care does not have to say
so. One that does gives the link a bus of its own.
The service opens `can0` as soon as it starts, and every machine but the Pi
lacks one, which the updater is built to keep running without.
Author
Collaborator

Two of these three clauses are already in AbsentCanInterface's own docstring, one patch.object away. Only "The service opens can0 as soon as it starts" adds anything here; cut the rest.

Two of these three clauses are already in `AbsentCanInterface`'s own docstring, one `patch.object` away. Only "The service opens `can0` as soon as it starts" adds anything here; cut the rest.
tests/fakes.py Outdated
@ -59,3 +52,1 @@
The transport arms its reader in the same callback it takes the
descriptor in, with nothing awaited in between, so anything that can
see this flag set is already a loop turn past the arming.
The transport arms its reader in the same callback, nothing awaited between,
Author
Collaborator

"in the same callback" is wrong — _async_open is a coroutine, and fileno() and add_reader sit in the same coroutine step of it. Say "step" so the reader looking at transport.py finds what this describes.

"in the same callback" is wrong — `_async_open` is a coroutine, and `fileno()` and `add_reader` sit in the same coroutine step of it. Say "step" so the reader looking at `transport.py` finds what this describes.
tests/fakes.py Outdated
@ -125,8 +115,7 @@ class AbsentCanInterface:
"""The van's bus on a machine that has none, which is every test runner.
Refusing to open looks exactly like a Pi whose `can0` is not up, which the
Author
Collaborator

Summary and body say the same thing twice — "a machine that has none" and "looks exactly like a Pi whose can0 is not up". One of them can go; keep "which the updater is built to run without", which is the part that is a reason.

Summary and body say the same thing twice — "a machine that has none" and "looks exactly like a Pi whose `can0` is not up". One of them can go; keep "which the updater is built to run without", which is the part that is a reason.
tests/fakes.py Outdated
@ -294,1 +266,3 @@
same moment, and give up five seconds later blaming the clock for it.
`_background_tasks` rather than `asyncio.all_tasks`, private though it is: it
is exactly the set `async_block_till_done` leaves out, and every task on the
loop would catch anything that merely began in the same moment.
Author
Collaborator

The cut dropped the verb, so the clause has no subject: "and every task on the loop would catch anything that merely began in the same moment". Make it "waiting on every task on the loop would catch anything that merely began in the same moment".

The cut dropped the verb, so the clause has no subject: "and every task on the loop would catch anything that merely began in the same moment". Make it "waiting on every task on the loop would catch anything that merely began in the same moment".
Take the review: fix a dropped verb, a wrong claim and two repeats
All checks were successful
Lint, type check and test / hassfest (pull_request) Successful in 26s
Lint, type check and test / quality (pull_request) Successful in 1m52s
Lint, type check and test / release (pull_request) Has been skipped
9e14307b12
Claude left a comment

All four rewrites check out, nothing new drifted, still only the two files. The can0 claim holds at updater/link.py:150 — the link opens on start and logs "The updater will run without one" on BusError, which is what AbsentCanInterface now says. Nothing further from me.

All four rewrites check out, nothing new drifted, still only the two files. The `can0` claim holds at `updater/link.py:150` — the link opens on start and logs "The updater will run without one" on `BusError`, which is what `AbsentCanInterface` now says. Nothing further from me.
Claude merged commit 83903bd9b8 into feat/firmware-updates 2026-09-20 07:06:05 +00:00
Claude deleted branch docs/test-fixture-comments 2026-09-20 07:06:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanHomeAssistant!74
No description provided.