From 0350b943d7aa04d4804b1a3317977f6adeb00208 Mon Sep 17 00:00:00 2001 From: ScottW514 Date: Tue, 13 Oct 2026 18:14:26 -0400 Subject: [PATCH] forgetest: laser.py's unused motion imports, and the two helpers no test calls laser.py imported wait_state, wait_state_text, wait_left_state and drain_text from motion.py and used none of them. wait_state and drain_text stay in motion.py, which uses them; wait_state_text and wait_left_state had no caller anywhere, so they go. Proof: pyflakes no longer reports laser.py's four unused imports and adds no finding. The coverage lint reports 0 uncovered paths and 0 host-tested row problems over 108 tests (its one failure is setup.check-lens's src/lensfind.* entry, which the forgectrl pin bump clears); the gate self-check refuses an empty artifact cleanly; the forgetest host suite passes under Linux (539 tests). Acceptance: the shared text of laser.py and motion.py moves, and with motion.py's the tests of every module that imports it (motion, laser, tray, updlock, and bedsize through homeoff). Against the image on the bench that adds no run: 6a434bb already changed both files' shared text. --- forgetest/forgetest/suite/laser.py | 3 +-- forgetest/forgetest/suite/motion.py | 33 ----------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/forgetest/forgetest/suite/laser.py b/forgetest/forgetest/suite/laser.py index 161f37a..87950ba 100644 --- a/forgetest/forgetest/suite/laser.py +++ b/forgetest/forgetest/suite/laser.py @@ -28,8 +28,7 @@ import time from ..catalog import test from .. import hw from ..runner import Failed -from .motion import (kernel_xy_mm, kernel_start, check_kernel_returned, wait_state, - wait_state_text, wait_left_state, drain_text, Watch, machine_idle, +from .motion import (kernel_xy_mm, kernel_start, check_kernel_returned, Watch, machine_idle, _job, _job_post, _job_wait, _lease_holder, _port_state, _words) _LASER_COVERS = [("grblhal-glowforge", "src/**"), ("kernel-module-glowforge", "**"), diff --git a/forgetest/forgetest/suite/motion.py b/forgetest/forgetest/suite/motion.py index a07f3ad..dff55c3 100644 --- a/forgetest/forgetest/suite/motion.py +++ b/forgetest/forgetest/suite/motion.py @@ -63,39 +63,6 @@ def wait_state(ctx, g, prefix, timeout): return None -def wait_state_text(ctx, g, prefix, timeout): - """wait_state, keeping everything the controller said while polling. - The driver reports a press with a [MSG:] line the moment it acts on it - - inside the poll window - so a test that wants both the state and the - message has to collect them together.""" - end = time.time() + timeout - text = "" - while time.time() < end: - ctx.checkpoint() - st = g.status_report() - text += g.drain() - if st["state"].startswith(prefix): - return st, text - time.sleep(0.1) - return None, text + g.drain() - - -def wait_left_state(ctx, g, prefix, timeout): - """The first report whose state is no longer `prefix`, with the text. - Leaving a state is what proves a command was acted on; catching the - state it moves INTO is a race whenever the remaining work is short.""" - end = time.time() + timeout - text = "" - while time.time() < end: - ctx.checkpoint() - st = g.status_report() - text += g.drain() - if not st["state"].startswith(prefix): - return st, text - time.sleep(0.1) - return None, text + g.drain() - - def wait_idle(ctx, g, timeout=30.0, poll=0.05, grace=0.3): """Poll until Idle; returns (peak_feed_mm_min, states_seen, final_report). An Idle report inside the first `grace` seconds counts only once a