From 179fbd55795c27ed388860e3c6b3d8c0651422ac Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 20 Jul 2026 23:44:35 -0500 Subject: test: fix the weak assertions from the S6/S7 audit The Hyprland socket check passed a shell glob to `test -S`, which breaks at both edges: zero matches leaves the literal pattern and several instances pass multiple args, failing for reasons unrelated to the socket. It now resolves one socket with find -type s. The gen_tokens degenerate-marker test asserted properties loose enough to pass on garbled output. It now pins the exact reconstruction as a characterization, with the impossible-input caveat stated, so any change to the branch surfaces. The gallery tick count leaned on split-string omit-nulls arithmetic that happened to equal the match count. It now counts occurrences directly. gallery-widget-write-svg, the last uncovered public entry point, gets a Normal-case test. --- scripts/testing/tests/test_desktop.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts/testing/tests') diff --git a/scripts/testing/tests/test_desktop.py b/scripts/testing/tests/test_desktop.py index 468bc75..1538d6a 100644 --- a/scripts/testing/tests/test_desktop.py +++ b/scripts/testing/tests/test_desktop.py @@ -93,7 +93,13 @@ def test_hyprland_socket(host, hyprland_installed, compositor_running): pytest.skip("Hyprland not installed") if not compositor_running: pytest.skip("Hyprland not running (headless) — socket check not applicable") - assert host.run("test -S /tmp/hypr/*/.socket.sock").rc == 0 + # `test -S` on a shell glob breaks at both edges: zero matches leaves the + # literal pattern (rc 1) and several instances pass multiple args (rc 2). + # find -type s proves exactly one live socket path exists. + sock = host.run( + "find /tmp/hypr -maxdepth 2 -name .socket.sock -type s | head -1" + ).stdout.strip() + assert sock, "no Hyprland socket found under /tmp/hypr" @pytest.mark.attribution("archsetup") -- cgit v1.2.3