diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-20 23:44:35 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-20 23:44:35 -0500 |
| commit | 179fbd55795c27ed388860e3c6b3d8c0651422ac (patch) | |
| tree | 6c6d8d83257660cb83abe26bebdc71a5affb5797 /scripts/testing/tests | |
| parent | 26eb578ab94610670196e632090b841f23611ce6 (diff) | |
| download | archsetup-179fbd55795c27ed388860e3c6b3d8c0651422ac.tar.gz archsetup-179fbd55795c27ed388860e3c6b3d8c0651422ac.zip | |
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.
Diffstat (limited to 'scripts/testing/tests')
| -rw-r--r-- | scripts/testing/tests/test_desktop.py | 8 |
1 files changed, 7 insertions, 1 deletions
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") |
