Cut the test fixtures' and fakes' comments to their reasons #74
Loading…
Reference in a new issue
No description provided.
Delete branch "docs/test-fixture-comments"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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_SECONDSandGIVE_UP_AFTERthat only re-spelttheir 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_mockis what gets the real updater client back, that the fetch stopleaks 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,watchedas aloop-turn-safe signal, and
_background_tasksoverasyncio.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.
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_socketin the plugin),aioclient_mockreally is the opt-out,service.pyreally sets the moduleFETCH_STOPon 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 sayso. 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 Pilacks one, which the updater is built to keep running without.Two of these three clauses are already in
AbsentCanInterface's own docstring, onepatch.objectaway. Only "The service openscan0as soon as it starts" adds anything here; cut the rest.@ -59,3 +52,1 @@The transport arms its reader in the same callback it takes thedescriptor in, with nothing awaited in between, so anything that cansee this flag set is already a loop turn past the arming.The transport arms its reader in the same callback, nothing awaited between,"in the same callback" is wrong —
_async_openis a coroutine, andfileno()andadd_readersit in the same coroutine step of it. Say "step" so the reader looking attransport.pyfinds what this describes.@ -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 theSummary and body say the same thing twice — "a machine that has none" and "looks exactly like a Pi whose
can0is not up". One of them can go; keep "which the updater is built to run without", which is the part that is a reason.@ -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: itis exactly the set `async_block_till_done` leaves out, and every task on theloop 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".
All four rewrites check out, nothing new drifted, still only the two files. The
can0claim holds atupdater/link.py:150— the link opens on start and logs "The updater will run without one" onBusError, which is whatAbsentCanInterfacenow says. Nothing further from me.