test(cli): skip the permission-preservation cases on Windows

The four new mode-preservation guards assert POSIX permission bits, which
Windows does not model (os.chmod only toggles the read-only flag there).
Guard them the way the suite already guards POSIX-specific semantics so the
tests stay meaningful on Linux/macOS without failing for Windows contributors.
The symlink cases stay unguarded, matching the existing symlink tests in
tests/hermes_cli/.
This commit is contained in:
briandevans
2026-08-05 04:50:04 -07:00
committed by kshitij
parent 67827dd99e
commit c005546cbc
4 changed files with 10 additions and 0 deletions
+2
View File
@@ -1,6 +1,7 @@
"""Tests for ``hermes migrate xai`` — apply path with ruamel round-trip."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
@@ -269,6 +270,7 @@ class TestCrashDurability:
assert real.read_text(encoding="utf-8") == link.read_text(encoding="utf-8")
assert "grok-4.3" in real.read_text(encoding="utf-8")
@pytest.mark.skipif(sys.platform == "win32", reason="POSIX permission bits")
def test_existing_file_mode_is_preserved(self, trap_config: Path):
"""Managed (NixOS 0640) and container installs widen config.yaml
deliberately; the migration must not silently tighten it to 0600."""
@@ -10,6 +10,7 @@ mocking git would just test the mock.
from __future__ import annotations
import sys
from pathlib import Path
import pytest
@@ -720,6 +721,9 @@ class TestManifestCrashDurability:
# No temp file left behind next to the manifest.
assert list(tmp_path.glob("*.tmp")) == []
@pytest.mark.skipif(
sys.platform == "win32", reason="POSIX permission bits"
)
def test_existing_file_mode_is_preserved(self, tmp_path):
import os
import stat
@@ -10,6 +10,7 @@ from __future__ import annotations
import os
import stat
import sys
from pathlib import Path
import pytest
@@ -104,6 +105,7 @@ class TestCrashDurability:
assert "# Hermes Agent" not in real.read_text(encoding="utf-8")
assert "export EDITOR=vim" in real.read_text(encoding="utf-8")
@pytest.mark.skipif(sys.platform == "win32", reason="POSIX permission bits")
def test_existing_file_mode_is_preserved(self, fake_home: Path):
"""Shell rc files are normally 0644; uninstalling must not change that."""
rc = fake_home / ".zshrc"
@@ -14,6 +14,7 @@ from __future__ import annotations
import os
import stat
import sys
from pathlib import Path
import pytest
@@ -96,6 +97,7 @@ class TestSoulWriteDurability:
# No temp file left behind in the profile directory.
assert list(profile_dir.glob("*.tmp")) == []
@pytest.mark.skipif(sys.platform == "win32", reason="POSIX permission bits")
def test_existing_file_mode_is_preserved(self, client, profile_dir: Path):
"""Profile SOUL.md is created 0644 and never run through
``_secure_file``; saving from the dashboard must not change that."""