diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-20 12:02:47 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-20 12:02:47 -0500 |
| commit | 2172c904e34e044ba938d5a4948182d9fd878816 (patch) | |
| tree | 32779fa37aab789a21b10dcc42deeb3b2155d8d7 /Makefile | |
| parent | 3044d4fbcf9077879784f433ae87ac452393e3d5 (diff) | |
| download | archsetup-2172c904e34e044ba938d5a4948182d9fd878816.tar.gz archsetup-2172c904e34e044ba938d5a4948182d9fd878816.zip | |
docs: document the unit-test layer and add a make test-unit target
The README only covered the VM integration harness. The unit suites under tests/ (one directory per script, fake binaries on PATH) went unmentioned, so a contributor adding a .local/bin script had no way to know they existed or how to run them.
I added a make test-unit target that runs every tests/*/test_*.py suite explicitly. unittest discover can't find them because the per-script directory names are hyphenated and aren't valid package paths. Then I split the README Testing section into Unit and VM-integration layers, added a guide for adding a suite, and pointed Contributing at test-unit for script changes.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -10,7 +10,7 @@ DE := $(filter dwm hyprland,$(MAKECMDGOALS)) # Extract DEST from command line for import (e.g., 'make import common' -> DEST=common) DEST := $(filter common dwm hyprland,$(MAKECMDGOALS)) -.PHONY: help deps stow restow reset unstow import test test-keep test-vm-base common dwm hyprland +.PHONY: help deps stow restow reset unstow import test-unit test test-keep test-vm-base common dwm hyprland # Default target - show help help: @@ -30,6 +30,7 @@ help: @echo " reset Resolve conflicts, keep repo version - requires DE" @echo " unstow Remove all symlinks - requires DE" @echo " import Import new app configs into repo (fzf) - requires dest" + @echo " test-unit Run fast unit tests for scripts (no VM needed)" @echo " test Run full VM test suite (creates base VM if needed)" @echo " test-keep Run test and keep VM running for manual testing" @echo " test-vm-base Create base VM only (runs archangel)" @@ -161,6 +162,18 @@ import: check-dest echo ""; \ echo "Done. Don't forget to: git add -A && git commit" +# Run the fast unit-test suites for individual scripts (no VM needed). +# One suite per tests/<script>/ dir; `unittest discover` can't find them +# because the dir names are hyphenated, so each suite is run explicitly. +test-unit: + @fail=0; \ + for t in tests/*/test_*.py; do \ + mod=$$(echo "$$t" | sed 's|/|.|g; s|\.py$$||'); \ + echo "==> $$mod"; \ + python3 -m unittest "$$mod" || fail=1; \ + done; \ + exit $$fail + # Create base VM for testing (runs archangel only, no archsetup) test-vm-base: @bash scripts/testing/create-base-vm.sh |
