test_setup_suite: only registered tests named

The file named setup.mirror (gone at 70e13bd) and setup.first-run-page,
setup.check-sensors, setup.check-intakes and setup.floor (gone at
f9c298a), so it failed in forgetest-ci's discover run. Every id, cover,
requires edge and attended list it asserts is now a registered test:

- IDS and OPERATOR: account-login, ssh-until-reboot, machine-name and
  first-run-flow; the four assertions on ids long folded into others go
  with them.
- the takeover check names first-run-flow; the mirror's covers check goes.
- the intake precheck: setup.check-airflow.
- first-run-flow: its fixture run and its backend covers, without the
  page's half.
- the attended setup tests: setup.cloud-header-capture and setup.focus.

It also puts tests/ on sys.path before importing helpers, as the other
suite tests do, so python -B -m unittest tests.test_setup_suite runs from
forgetest/.

Proof: python -B -m unittest tests.test_setup_suite and discover -p
test_setup_suite.py, 30 OK under Linux and on Windows; pyflakes.
tests/** is in no fingerprint.
This commit is contained in:
ScottW514
2026-10-14 21:13:56 -04:00
parent f9c298a347
commit 4c6ca8d701
+15 -35
View File
@@ -10,18 +10,18 @@ for a gated supervisor."""
import json import json
import os import os
import shutil import shutil
import sys
import tempfile import tempfile
import unittest import unittest
import helpers sys.path.insert(0, os.path.dirname(__file__))
from forgetest import baseline, catalog import helpers # noqa: E402
from forgetest.suite import setup from forgetest import baseline, catalog # noqa: E402
from forgetest.suite import setup # noqa: E402
IDS = ("setup.account-login", IDS = ("setup.account-login",
"setup.ssh-until-reboot", "setup.machine-name", "setup.first-run-flow", "setup.ssh-until-reboot", "setup.machine-name", "setup.first-run-flow")
"setup.first-run-page", OPERATOR = ("setup.first-run-flow",)
"setup.mirror")
OPERATOR = ("setup.first-run-flow", "setup.first-run-page")
class RegistrationTests(unittest.TestCase): class RegistrationTests(unittest.TestCase):
@@ -36,19 +36,9 @@ class RegistrationTests(unittest.TestCase):
for tid in IDS: for tid in IDS:
if tid not in OPERATOR: if tid not in OPERATOR:
self.assertEqual(kinds[tid], "auto", tid) self.assertEqual(kinds[tid], "auto", tid)
self.assertNotIn("setup.root-ssh-refused", self.reg) # folded into ssh-until-reboot
self.assertNotIn("setup.wizard-first-run", self.reg) # split into the flow and the page
self.assertNotIn("setup.override-until-reboot", self.reg) # the gate has nothing to lift
self.assertNotIn("setup.sheet", self.reg) # the two burns, each on its own scrap
def test_the_record_swapping_tests_are_takeovers(self): def test_the_record_swapping_tests_are_takeovers(self):
for tid in ("setup.first-run-flow", "setup.first-run-page", "setup.mirror"): self.assertEqual(self.reg["setup.first-run-flow"].hardware, "takeover")
self.assertEqual(self.reg[tid].hardware, "takeover", tid)
def test_the_lifecycle_tests_cover_their_files(self):
mirror = set(self.reg["setup.mirror"].covers)
self.assertIn(("forgectrl", "src/wizdark.*"), mirror)
self.assertIn("setup.check-sensors", self.reg["setup.mirror"].requires)
def test_recommended_reads_the_status_document(self): def test_recommended_reads_the_status_document(self):
w = {"recommended": [{"id": "laser.floor", "reason": "the tube was replaced"}, w = {"recommended": [{"id": "laser.floor", "reason": "the tube was replaced"},
@@ -68,37 +58,27 @@ class RegistrationTests(unittest.TestCase):
def test_the_intake_tests_start_from_a_count(self): def test_the_intake_tests_start_from_a_count(self):
reg = self.reg reg = self.reg
from forgetest.suite import setup_dark from forgetest.suite import setup_dark
for tid in ("setup.check-intakes", "setup.check-airflow"): self.assertIs(reg["setup.check-airflow"].precheck, setup_dark.intakes_counted)
self.assertIs(reg[tid].precheck, setup_dark.intakes_counted, tid)
def test_the_first_run_flow_runs_unattended_with_the_fixture_and_the_page_walk_does_not(self): def test_the_first_run_flow_runs_unattended_with_the_fixture(self):
flow = self.reg["setup.first-run-flow"] flow = self.reg["setup.first-run-flow"]
self.assertEqual(list(flow.actions), ["button"]) self.assertEqual(list(flow.actions), ["button"])
self.assertFalse(flow.hands) self.assertFalse(flow.hands)
self.assertTrue(flow.fixture_runnable(("button", "lid", "interlock"))) self.assertTrue(flow.fixture_runnable(("button", "lid", "interlock")))
page = self.reg["setup.first-run-page"]
self.assertTrue(page.hands)
self.assertFalse(page.fixture_runnable(("button", "lid", "interlock")))
self.assertIn("setup.first-run-flow", page.requires)
def test_the_first_run_split_keeps_the_backend_and_the_page_apart(self): def test_the_first_run_flow_covers_the_backend(self):
flow = set(self.reg["setup.first-run-flow"].covers) flow = set(self.reg["setup.first-run-flow"].covers)
page = set(self.reg["setup.first-run-page"].covers)
for want in (("forgectrl", "src/wiz.*"), ("forgectrl", "src/setup.*"), ("forgectrl", "src/users.*"), for want in (("forgectrl", "src/wiz.*"), ("forgectrl", "src/setup.*"), ("forgectrl", "src/users.*"),
("forgectrl", "src/button.*"), ("forgectrl", "src/led.*"), ("forgectrl", "src/advisories.*")): ("forgectrl", "src/button.*"), ("forgectrl", "src/led.*"), ("forgectrl", "src/advisories.*")):
self.assertIn(want, flow, want) self.assertIn(want, flow, want)
self.assertNotIn(want, page, want)
for want in (("forgectrl", "src/ui/wizard.*"), ("forgectrl", "src/ui/md.js"), ("forgectrl", "src/tls.*")):
self.assertIn(want, page, want)
def test_the_only_attended_tests_need_a_workstation_or_a_scrap(self): def test_the_only_attended_tests_need_a_workstation_or_a_scrap(self):
# With the bench actuator up, four setup tests keep a person: the # With the bench actuator up, two setup tests keep a person: the
# page walk, the print from the Glowforge app, and the two burns, # print from the Glowforge app, and the focus burn on a fresh
# each on a fresh scrap. Everything else runs from the queue. # scrap. Everything else runs from the queue.
attended = sorted(tid for tid, t in self.reg.items() if tid.startswith("setup.") attended = sorted(tid for tid, t in self.reg.items() if tid.startswith("setup.")
and t.kind != "auto" and not t.fixture_runnable(("button", "lid", "interlock"))) and t.kind != "auto" and not t.fixture_runnable(("button", "lid", "interlock")))
self.assertEqual(attended, ["setup.cloud-header-capture", "setup.first-run-page", self.assertEqual(attended, ["setup.cloud-header-capture", "setup.focus"])
"setup.floor", "setup.focus"])
def test_the_machine_name_covers_nothing_by_design(self): def test_the_machine_name_covers_nothing_by_design(self):
self.assertEqual(self.reg["setup.machine-name"].covers, ()) self.assertEqual(self.reg["setup.machine-name"].covers, ())