diff --git a/forgetest/forgetest/suite/evmore.py b/forgetest/forgetest/suite/evmore.py index 6a3b8f2..3046d3f 100644 --- a/forgetest/forgetest/suite/evmore.py +++ b/forgetest/forgetest/suite/evmore.py @@ -49,8 +49,11 @@ def _reader(sock, seen, stop): @test("events.button-telemetry", title="The event stream tells a press of the button, and the telemetry", - subsystem="forgectrl", kind="auto", mode="grbl", est_min=2, + subsystem="forgectrl", kind="operator", mode="grbl", est_min=2, covers=[("forgectrl", "src/events.*"), ("forgectrl", "src/main.c"), ("forgectrl", "src/status.*")], + actions=["button"], + steps=["The machine idle; you will be told to press the button once.", + "Nothing moves and nothing fires: nothing is waiting for the press."], description="A stream opened at forgectrl's read-only listener gets a telemetry.tick within 12 s, " "and it is what the daemon already holds: the cooling phase, the verdict, fire_ok, the " "two coolant temperatures, the controller's state, and the lid, with no sensor read of " diff --git a/forgetest/forgetest/suite/exthost.py b/forgetest/forgetest/suite/exthost.py index 0f3f7b0..4c322c9 100644 --- a/forgetest/forgetest/suite/exthost.py +++ b/forgetest/forgetest/suite/exthost.py @@ -1542,10 +1542,12 @@ def hold_pause_tier(ctx): # ------------------------------------------------- the operator's door @test("exthost.events", title="The machine's events reach a package, over one subscription", - subsystem="exthost", kind="auto", hardware="takeover", est_min=6, + subsystem="exthost", kind="operator", hardware="takeover", est_min=6, covers=[("forgeext", "src/evfeed.*"), ("forgeext", "src/api.*"), ("forgeext", "src/run.*"), ("forgectrl", "src/events.*"), ("forgectrl", "src/main.c")], - requires=["exthost.service"], + requires=["exthost.service"], actions=["lid"], + steps=["Start with the lid closed; you will be told to open it, then close it again.", + "Nothing moves and the laser is not involved."], description="The reference package is installed with the events capability. The host holds one " "subscription to forgectrl's stream for every package that wants events, and none when " "no package does: with the service running the status file says the stream is connected " diff --git a/forgetest/forgetest/suite/setup_dark.py b/forgetest/forgetest/suite/setup_dark.py index 4793a2e..f2a4b55 100644 --- a/forgetest/forgetest/suite/setup_dark.py +++ b/forgetest/forgetest/suite/setup_dark.py @@ -121,7 +121,7 @@ def run_check(ctx, wid, on_prompt, timeout_s): @test("setup.check-switches", title="The switches check follows the lid and the button", subsystem="setup", kind="operator", est_min=3, covers=DARK_COVERS + [("forgectrl", "src/status.c")], - requires=["forgectrl.auth"], actions=["lid", "button"], + requires=["forgectrl.auth"], actions=["lid", "button", "interlock"], description="POST /wiz/switches/start; the check asks for the lid to open and close and for " "a press, each as a 'wait' prompt that the switch edge itself answers; the bench " "fixture works the lid and the button. On a Basic or Plus the interlock loop reads " diff --git a/forgetest/tests/test_fixture.py b/forgetest/tests/test_fixture.py index bb38a04..50c1f4a 100644 --- a/forgetest/tests/test_fixture.py +++ b/forgetest/tests/test_fixture.py @@ -314,6 +314,24 @@ class CatalogTests(unittest.TestCase): with self.assertRaises(ValueError): catalog.test("z.auto", title="t", subsystem="z", hands=("app",))(lambda ctx: None) + def test_every_action_a_test_takes_is_declared(self): + # The queues route a test by its kind and its actions: an auto test + # runs unattended with or without a fixture, and an operator test + # whose actions the fixture covers runs unattended only while it + # does. A test that acts on the lid, the interlock or the button + # without saying so runs unattended with no fixture and waits for a + # person who is not there. + import inspect + import re + from forgetest import catalog + bad = [] + for t in catalog.all_tests(catalog.load_suite()): + src = inspect.getsource(t.fn) + taken = set(re.findall(r'ctx\.act\(\s*"(\w+)"', src)) + if taken and (t.kind == "auto" or not taken <= set(t.actions)): + bad.append("%s (%s) acts on %s, declares %s" % (t.id, t.kind, sorted(taken), list(t.actions))) + self.assertEqual(bad, []) + class StubFixture: """What the runner needs of a fixture, scripted."""