mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-06 12:52:04 +00:00
Make the Tests workflow able to fail on Windows, and skip two POSIX-only tests
The Tests workflow reported SUCCESS on Windows while its own log read "2 failed, 1114 passed". On Windows a multi-line `run:` block executes under pwsh, where only the last command decides the step's result -- so `coverage xml` succeeding hid `pytest` failing. Linux and macOS use bash -e and did catch it, which is why this was invisible. `shell: bash` on that step fixes it, and the same hazard is fixed in python-ci.yml's install step. An audit of every Windows-capable multi-line step found no others; the installer smoke steps are Unix-guarded and already set -euo pipefail. A check that cannot go red is worse than no check, because it is trusted -- and this one has been trusted while six Windows tests failed underneath it. Two of those six are now skipped on Windows: they assert POSIX mode 0o600, which cannot hold where os.chmod only toggles a read-only flag and st_mode reads back 0o666. Skipped rather than relaxed, because the property is real and a weakened assertion would answer it falsely. Whether these files -- the semantic index among them, which holds stored secrets -- are actually protected from other users on Windows is an ACL question, now recorded. The remaining four are TUI tests that assume POSIX paths. They are recorded rather than patched: reproducing them needs a Windows host, and guessing at path normalization and palette-argument parsing would mean changing tests to match an assumption rather than a behaviour. They also interact with the undeclared-textual finding -- those tests SKIP everywhere except Windows, the one platform they were not written for. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Vtx94nXDmNgXEeThUZP4QN
This commit is contained in:
1 parent
bb1f4d5f2b
commit
527d7be5c5
5 files changed
+71
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
import pytest
|
||||
from multiprocessing import Process
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from utils.atomic_write import atomic_write
|
||||
@@ -77,6 +78,17 @@ def test_atomic_write_preserves_existing_on_failure(tmp_path: Path) -> None:
|
||||
assert dest_path.read_text() == "original content"
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
sys.platform == "win32",
|
||||
reason=(
|
||||
"POSIX mode bits do not exist on Windows: os.chmod only toggles the "
|
||||
"read-only flag and st_mode reads back 0o666, so this assertion cannot "
|
||||
"hold there. It is SKIPPED rather than relaxed because the property it "
|
||||
"checks is real -- whether these files are protected from other users "
|
||||
"on Windows is an open question about ACLs, recorded in TODO.md, and "
|
||||
"a weakened assertion would answer it falsely."
|
||||
),
|
||||
)
|
||||
def test_atomic_write_permissions(tmp_path: Path) -> None:
|
||||
"""File permissions should be set to 0o600 (owner read/write only)."""
|
||||
import stat
|
||||
|
||||
Reference in new issue
Block a user