aboutsummaryrefslogtreecommitdiff
path: root/tests/nvidia-preflight/test_nvidia_preflight.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-20 16:00:39 -0500
committerCraig Jennings <c@cjennings.net>2026-07-20 16:00:39 -0500
commit67d0b6ea2e132a4ac9fd25bb977dbc4cb62b3230 (patch)
tree164ac7d44cd293820d373274406f8278c8525e7f /tests/nvidia-preflight/test_nvidia_preflight.py
parentdb6ca439938e4a57e6d1f8d7487346a67f7c439e (diff)
downloadarchsetup-67d0b6ea2e132a4ac9fd25bb977dbc4cb62b3230.tar.gz
archsetup-67d0b6ea2e132a4ac9fd25bb977dbc4cb62b3230.zip
refactor(installer): extract validate_yesno and a NVIDIA driver-floor constant
Four near-identical blocks validated that AUTOLOGIN, NO_GPU_DRIVERS, INSTALL_CLAUDE_CODE, and INSTALL_DEVICE_UDEV_RULES were empty or exactly yes/no. They collapse into a validate_yesno helper the callers guard with `|| exit 1`. The NVIDIA driver floor of 535 was a magic literal in the comparison and three prose lines. It now lives in a NVIDIA_MIN_DRIVER constant, and the nvidia-preflight test sources that constant alongside the function it extracts. This is the safe, purely-testable slice of the refactor rollup. The structural extractions that touch the installer's system-mutation paths -- the GPU modalias scan, the stow and retry loops, the display-server/window-manager dispatch, and the snapper/fsck/GRUB/waybar sed blocks -- are split into a follow-up so they get characterization coverage first rather than a blind rewrite.
Diffstat (limited to 'tests/nvidia-preflight/test_nvidia_preflight.py')
-rw-r--r--tests/nvidia-preflight/test_nvidia_preflight.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/nvidia-preflight/test_nvidia_preflight.py b/tests/nvidia-preflight/test_nvidia_preflight.py
index bdacfd5..191e983 100644
--- a/tests/nvidia-preflight/test_nvidia_preflight.py
+++ b/tests/nvidia-preflight/test_nvidia_preflight.py
@@ -50,7 +50,8 @@ class NvidiaPreflightHarness(unittest.TestCase):
"#!/bin/bash\n"
'ARCHSETUP="$1"; shift\n'
"source <(sed -n "
- "'/^nvidia_preflight_report() {/,/^}/p' \"$ARCHSETUP\")\n"
+ "'/^NVIDIA_MIN_DRIVER=/p;"
+ "/^nvidia_preflight_report() {/,/^}/p' \"$ARCHSETUP\")\n"
"nvidia_preflight_report\n"
)
os.chmod(self.wrapper, 0o755)