refactor: split the full-screen tests by subject

test_install_tui.py held 16,850 lines. Its 100 test classes move whole into fourteen test_tui_* modules, the shared states, manifests and pseudo-terminal into tests/tuisupport.py. Methods one class borrowed from another live in holder classes there. CI and pr_checks.py run every new module on Python 3.8.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 07:37:15 +01:00
1 parent bedfeec772
commit c3b67d5485
25 files changed
+17467 -16862

No files matched your search

+12 -1
View File
@@ -23,6 +23,16 @@ class Step:
may_fail: bool = False
# The full-screen tests, run again on the installer's Python floor.
TUI_MODULES = (
"tests.test_tui_card_counts", "tests.test_tui_card_setups", "tests.test_tui_card_space",
"tests.test_tui_choices", "tests.test_tui_devices", "tests.test_tui_flow",
"tests.test_tui_folders", "tests.test_tui_line_mode", "tests.test_tui_mouse",
"tests.test_tui_packs", "tests.test_tui_pty", "tests.test_tui_screens",
"tests.test_tui_terminal", "tests.test_tui_views",
)
# The order of validate.yml: data fetched, site generated and built, then the
# suite, its 3.8 run and the built-site check.
STEPS: tuple[Step, ...] = (
@@ -50,7 +60,8 @@ STEPS: tuple[Step, ...] = (
needs="npm", provider="Node 24", env={"NODE_DISABLE_COMPILE_CACHE": "1"}),
Step("python scripts/run_tests.py --jobs 4", "the suite, one process per module",
env={"RETROBIOS_OFFLINE": "1"}),
Step("python3.8 -m unittest tests.test_install_tui", "the full screen on the installer's floor",
Step("python3.8 -m unittest " + " ".join(TUI_MODULES),
"the full screen on the installer's floor",
needs="python3.8", provider="a Python 3.8 with pyte",
env={"RETROBIOS_OFFLINE": "1"}),
Step("python scripts/validate_site.py --site-dir website/dist", "links and page budgets"),
+19 -2
View File
@@ -439,6 +439,24 @@ def render_readme(inputs: ReadmeInputs) -> str:
return "\n".join(lines) + "\n"
# Past this width a command takes its comment on the line above: the 3.8 run
# names fourteen modules, and aligning on it pushed every comment off the page.
STEP_WIDTH = 72
def check_lines() -> str:
"""The checks of pr_checks.py, each with what it covers."""
commands = [(prchecks.shown(step), step.why) for step in prchecks.STEPS]
width = max(len(command) for command, _ in commands if len(command) <= STEP_WIDTH)
lines = []
for command, why in commands:
if len(command) > STEP_WIDTH:
lines += [f"# {why}", command]
else:
lines.append(f"{command:<{width}} # {why}")
return "\n".join(lines)
def ci_install_lines() -> tuple[str, str]:
"""The pip lines the test job of validate.yml runs, verbatim.
@@ -464,8 +482,7 @@ def contributing_text(
.md for the site); *site_words* names the site from where the text is read.
"""
pip_line, floor_line = ci_install_lines()
width = max(len(prchecks.shown(step)) for step in prchecks.STEPS)
steps = "\n".join(f"{prchecks.shown(step):<{width}} # {step.why}" for step in prchecks.STEPS)
steps = check_lines()
return f"""{title}
## Add a BIOS file