Files
alzeo/tests/test_installers_help.py
Hasan BasbunarandClaude Fable 5.2 405171397c install.sh installs the speech lane too (--no-speech leaves it out of a run)
Decision 1564 (2026-11-22): what this repo ships is there for everyone. The speech lane (Qwen3-ASR
and Kokoro on the CPU, beside any lane) was installed by its own script only, so a box that ran the
one command never had it. install.sh now runs install-speech.sh in a step of its own, on both of
its paths (the run that serves a text lane and the run of a box booting another lane): whole and
proved on a box without the lane, with --no-smoke on a box that has it, proved again when named
(--with-speech). It is no GPU lane: no Load, no switch target, no marker, and the lane registry keeps
it out of that machinery. --no-speech counts for the run that passes it, like every --no-<lane>.
A lane that does not install is said and the run goes on (run under set -e, tested with an
installer that fails). The lane stays stopped on a new box, as its installer leaves it.

Tests: tests/test_install_speech_default.py (the step and its line against a stub installer, the
flags, the help, both paths); the registry's check of install.sh's flags takes the speech lane's
two; the keep-as-is command of docs/operations.md names --no-speech.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 16:29:11 +01:00

45 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Each lane installer's --help prints its whole header, and nothing else.
The help printed fixed line ranges (sed -n '2,32p') that drifted as the headers grew: the Nemotron
lane's printed two lines of its code (v1.34.0), the image lane's stopped in the middle of a sentence,
and the Kolibri and video lanes' left their last paragraph out (found in review, 2026-10-16). Each
now prints its comment lines from the second to the first line of code, whatever their number. The
help's own line runs here on the installer's file; the installer itself is never run.
"""
import pathlib
import re
import subprocess
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
INSTALLERS = ("install-image.sh", "install-video.sh", "install-kolibri.sh", "install-nemotron.sh",
"install-nemotron-super.sh", "install-speech.sh", "install-image-h3.sh")
# What the header's last paragraph opens with. The GPU lanes end on the rule that one engine runs
# at a time; the speech lane runs on the CPU beside any of them, and ends on how the one command
# runs it (since v1.58.0; before, on why it left it out).
LAST_PARAGRAPH = {"install-speech.sh": "IN THE ONE COMMAND since v1.58.0"}
class TheHelpIsTheHeader(unittest.TestCase):
def test_each_prints_its_whole_header_and_no_code(self):
for script in INSTALLERS:
path = REPO / script
text = path.read_text()
lines = text.splitlines()
end = next(i for i, ln in enumerate(lines) if i > 0 and not ln.startswith("#"))
with self.subTest(script=script):
m = re.search(r"\n -h\|--help\) (awk '[^']*') \"\$0\"; exit 0 ;;\n", text)
self.assertIsNotNone(m, "its --help prints the header by its shape, not by line numbers")
out = subprocess.run(["bash", "-c", f'{m.group(1)} "$1"', "help", str(path)],
capture_output=True, text=True, check=True, timeout=10).stdout.splitlines()
self.assertEqual(out, lines[1:end])
self.assertGreater(len(out), 10)
self.assertTrue(all(ln.startswith("#") for ln in out), "no line of code")
self.assertIn(LAST_PARAGRAPH.get(script, "ONE ENGINE AT A TIME"), "\n".join(out),
"the header's last paragraph is there")
if __name__ == "__main__":
unittest.main()