Skip to content

The agent that grows with you

tests: replace every bare host skipif with platforms()

ethernet59624b7ace89
diff --git a/tests/agent/test_anthropic_adapter.py b/tests/agent/test_anthropic_adapter.py
index 78973b64f60..5508907c6c7 100644
--- a/tests/agent/test_anthropic_adapter.py
+++ b/tests/agent/test_anthropic_adapter.py
@@ -471,7 +471,7 @@ class TestWriteClaudeCodeCredentials:
assert data["otherField"] == "keep-me"
assert data["claudeAiOauth"]["accessToken"] == "new-tok"
- @pytest.mark.skipif(sys.platform.startswith("win"), reason="POSIX mode bits not enforced on Windows")
+ @pytest.mark.platforms("posix") # POSIX mode bits not enforced on Windows
def test_credentials_file_created_with_0o600(self, tmp_path, monkeypatch):
"""Refreshed Claude Code credentials must land on disk at 0o600.
diff --git a/tests/agent/test_claude_code_version_path.py b/tests/agent/test_claude_code_version_path.py
index 25adc0fa804..9784ab5f588 100644
--- a/tests/agent/test_claude_code_version_path.py
+++ b/tests/agent/test_claude_code_version_path.py
@@ -47,7 +47,7 @@ def test_gui_launch_reports_installed_version_not_fallback(monkeypatch, tmp_path
assert _detect_claude_code_version() == "2.1.276" != _CLAUDE_CODE_VERSION_FALLBACK
[email protected](sys.platform == "win32", reason="PATH lookup of an extensionless shim is POSIX-only")
[email protected]("posix") # PATH lookup of an extensionless shim is POSIX-only
def test_path_hit_is_probed_first(monkeypatch, tmp_path):
"""A PATH ``claude-code`` beats a stale prefix ``claude``: every PATH hit precedes every prefix."""
on_path = _install(tmp_path / "path", "claude-code")
diff --git a/tests/agent/test_command_secret_source.py b/tests/agent/test_command_secret_source.py
index 6e05a884f1a..5af2b78052f 100644
--- a/tests/agent/test_command_secret_source.py
+++ b/tests/agent/test_command_secret_source.py
@@ -43,9 +43,7 @@ from agent.secret_sources.base import ( # noqa: E402
from hermes_cli import env_loader # noqa: E402
-pytestmark = pytest.mark.skipif(
- os.name == "nt", reason="the command secret provider is POSIX-only"
-)
+pytestmark = pytest.mark.platforms("posix") # the command secret provider is POSIX-only
def _write_helper(tmp_path: Path, body: str, name: str = "helper.sh") -> Path:
diff --git a/tests/agent/test_deadline.py b/tests/agent/test_deadline.py
index 97b288d969f..5189d298480 100644
--- a/tests/agent/test_deadline.py
+++ b/tests/agent/test_deadline.py
@@ -407,7 +407,7 @@ class TestRunBoundedAsync:
# ---------------------------------------------------------------------------
[email protected](sys.platform == "win32", reason="POSIX process-group semantics")
[email protected]("posix") # POSIX process-group semantics
class TestKillProcessTree:
def test_kills_descendants_of_session_leader(self, tmp_path):
"""A child spawned with start_new_session must die with its own child.
diff --git a/tests/agent/test_private_credential_writers.py b/tests/agent/test_private_credential_writers.py
index 0992249c256..268b1aae3a4 100644
--- a/tests/agent/test_private_credential_writers.py
+++ b/tests/agent/test_private_credential_writers.py
@@ -18,7 +18,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="POSIX mode bits not enforced on Windows")
+pytestmark = pytest.mark.platforms("posix") # POSIX mode bits not enforced on Windows
_PRIVATE = stat.S_IRUSR | stat.S_IWUSR
diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py
index 8e2e5b45758..fa96e555b6f 100644
--- a/tests/agent/test_prompt_builder.py
+++ b/tests/agent/test_prompt_builder.py
@@ -580,10 +580,7 @@ class TestBuildContextFilesPrompt:
assert "Project Context" in result
- @pytest.mark.skipif(
- sys.platform == "darwin",
- reason="APFS default volume is case-insensitive; CLAUDE.md and claude.md alias the same path",
- )
+ @pytest.mark.platforms("not macos") # APFS default volume is case-insensitive; CLAUDE.md and claude.md alias the same path
def test_claude_md_uppercase_takes_priority(self, tmp_path):
uppercase = tmp_path / "CLAUDE.md"
lowercase = tmp_path / "claude.md"
diff --git a/tests/agent/test_shell_hooks_tree_kill.py b/tests/agent/test_shell_hooks_tree_kill.py
index 00254f51976..7fa7f942a33 100644
--- a/tests/agent/test_shell_hooks_tree_kill.py
+++ b/tests/agent/test_shell_hooks_tree_kill.py
@@ -23,9 +23,7 @@ import pytest
from agent.shell_hooks import ShellHookSpec, _spawn
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX process-group semantics"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX process-group semantics
def _spec(command: str, timeout: int = 2) -> ShellHookSpec:
diff --git a/tests/agent/test_treekill_consolidation.py b/tests/agent/test_treekill_consolidation.py
index bc48fea4baa..815fdcdd509 100644
--- a/tests/agent/test_treekill_consolidation.py
+++ b/tests/agent/test_treekill_consolidation.py
@@ -176,7 +176,7 @@ class TestCodeExecutionDelegation:
# ---------------------------------------------------------------------------
@pytest.mark.live_system_guard_bypass
[email protected](sys.platform == "win32", reason="POSIX session semantics")
[email protected]("posix") # POSIX session semantics
def test_e2e_setsid_grandchild_killed_via_compat_wrapper(tmp_path):
"""The delegating wrapper must reach descendants that setsid'd out of the
child's process group — the exact capability the shared primitive adds
diff --git a/tests/agent/test_vault_backends.py b/tests/agent/test_vault_backends.py
index 60898cbecf9..844e3fd2aaf 100644
--- a/tests/agent/test_vault_backends.py
+++ b/tests/agent/test_vault_backends.py
@@ -51,7 +51,7 @@ sys.exit(2)
'''
-pytestmark = pytest.mark.skipif(os.name == "nt", reason="fake bw is a shebang script; the backend under test is host-agnostic")
+pytestmark = pytest.mark.platforms("posix") # fake bw is a shebang script; the backend under test is host-agnostic
@pytest.fixture
diff --git a/tests/agent/test_verification_stop.py b/tests/agent/test_verification_stop.py
index 25b163106a3..06430f4bd3e 100644
--- a/tests/agent/test_verification_stop.py
+++ b/tests/agent/test_verification_stop.py
@@ -162,10 +162,7 @@ def test_nudge_checks_all_edited_workspaces(tmp_path, monkeypatch):
- sys.platform == "win32",
- reason="Symlinks require elevated privileges on Windows",
-)
[email protected]("posix") # Symlinks require elevated privileges on Windows
def test_no_suite_nudge_uses_canonical_temp_dir(tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
project = tmp_path / "project"
diff --git a/tests/agent/transports/test_codex_app_server_runtime.py b/tests/agent/transports/test_codex_app_server_runtime.py
index cf2d80840b6..1f5d16213b4 100644
--- a/tests/agent/transports/test_codex_app_server_runtime.py
+++ b/tests/agent/transports/test_codex_app_server_runtime.py
@@ -118,7 +118,7 @@ class TestCodexAppServerClose:
"""Lifecycle tests for retiring the optional Codex app-server transport."""
@pytest.mark.live_system_guard_bypass
- @pytest.mark.skipif(sys.platform == "win32", reason="start_new_session/setsid is POSIX-only")
+ @pytest.mark.platforms("posix") # start_new_session/setsid is POSIX-only
def test_close_reaps_independent_descendant_process_group(self, tmp_path):
"""A Codex-owned MCP child that calls setsid must not survive close().
diff --git a/tests/cron/test_cron_script.py b/tests/cron/test_cron_script.py
index f96892a2cf2..2d800a5b847 100644
--- a/tests/cron/test_cron_script.py
+++ b/tests/cron/test_cron_script.py
@@ -342,10 +342,7 @@ class TestRunJobScript:
assert argv == [sys.executable, str(script)]
- @pytest.mark.skipif(
- sys.platform == "win32",
- reason="Windows always takes the overlay/creationflags branch",
- )
+ @pytest.mark.platforms("posix") # Windows always takes the overlay/creationflags branch
def test_non_windows_script_keeps_locale_encoding_with_lossy_errors(self, cron_env, monkeypatch):
"""POSIX keeps the platform-default (locale) encoding — gating ``encoding=`` to win32
was deliberate (#66566: unconditional UTF-8 leaked into POSIX) — but decoding must be
@@ -626,10 +623,7 @@ class TestScriptPathContainment:
assert output == "sub ok"
- @pytest.mark.skipif(
- sys.platform == "win32",
- reason="Symlinks require elevated privileges on Windows",
- )
+ @pytest.mark.platforms("posix") # Symlinks require elevated privileges on Windows
def test_symlink_escape_blocked(self, cron_env, tmp_path):
"""Symlinks pointing outside scripts/ must be rejected."""
from cron.scheduler_script import _run_job_script
diff --git a/tests/cron/test_jobs_file_ownership.py b/tests/cron/test_jobs_file_ownership.py
index e1dce9bee42..323d1d2284b 100644
--- a/tests/cron/test_jobs_file_ownership.py
+++ b/tests/cron/test_jobs_file_ownership.py
@@ -25,9 +25,7 @@ import pytest
import cron.jobs as jobs
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX-only: uid/gid ownership semantics"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX-only: uid/gid ownership semantics
@pytest.fixture()
diff --git a/tests/cron/test_timezone.py b/tests/cron/test_timezone.py
index 5f142ae259d..c8726d483f6 100644
--- a/tests/cron/test_timezone.py
+++ b/tests/cron/test_timezone.py
@@ -196,7 +196,7 @@ class TestGetTimezone:
# execute_code child env — TZ injection
# =========================================================================
[email protected](sys.platform == "win32", reason="UDS not available on Windows")
[email protected]("posix") # UDS not available on Windows
class TestCodeExecutionTZ:
"""Verify TZ env var is passed to sandboxed child process via real execute_code."""
diff --git a/tests/gateway/test_control_socket.py b/tests/gateway/test_control_socket.py
index f820d511dd6..50b9758ea26 100644
--- a/tests/gateway/test_control_socket.py
+++ b/tests/gateway/test_control_socket.py
@@ -18,10 +18,7 @@ from gateway.control_socket import (
windows_pipe_name,
)
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32",
- reason="Unix-socket transport; the named-pipe half is covered on the wine2e lane",
-)
+pytestmark = pytest.mark.platforms("posix") # Unix-socket transport; the named-pipe half is covered on the wine2e lane
def _run(coro):
diff --git a/tests/gateway/test_control_socket_pause.py b/tests/gateway/test_control_socket_pause.py
index 07998ea36a5..f8649dbc878 100644
--- a/tests/gateway/test_control_socket_pause.py
+++ b/tests/gateway/test_control_socket_pause.py
@@ -56,7 +56,7 @@ def test_unknown_verb_still_lists_pause(tmp_path):
assert "pause-for-update" in response["supported_verbs"]
[email protected](sys.platform == "win32", reason="unix socket transport")
[email protected]("posix") # unix socket transport
def test_pause_client_roundtrip_over_real_socket(tmp_path):
"""Full client→socket→handler→ACK path over a REAL unix socket."""
@@ -85,7 +85,7 @@ def test_pause_client_roundtrip_over_real_socket(tmp_path):
assert result["pausing"] is True and result["drain_timeout"] == 12.5
[email protected](sys.platform == "win32", reason="unix socket transport")
[email protected]("posix") # unix socket transport
def test_pause_client_none_when_gateway_lacks_verb(tmp_path):
"""Back-compat: a step-1 gateway (identify/status only) answers ok:false
for the unknown verb → the client returns None → caller keeps the legacy
diff --git a/tests/gateway/test_control_socket_windows_live.py b/tests/gateway/test_control_socket_windows_live.py
index eccb6a272db..c8dc44576d4 100644
--- a/tests/gateway/test_control_socket_windows_live.py
+++ b/tests/gateway/test_control_socket_windows_live.py
@@ -27,9 +27,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform != "win32", reason="live Windows named-pipe E2E"
-)
+pytestmark = pytest.mark.platforms("windows") # live Windows named-pipe E2E
PROJECT_ROOT = Path(__file__).resolve().parents[2]
diff --git a/tests/gateway/test_host_attach_lifecycle.py b/tests/gateway/test_host_attach_lifecycle.py
index 933bb08fe49..0adfe5ba02d 100644
--- a/tests/gateway/test_host_attach_lifecycle.py
+++ b/tests/gateway/test_host_attach_lifecycle.py
@@ -231,8 +231,7 @@ def test_served_profiles_ignores_the_retired_opt_out_but_honours_an_explicit_arg
assert asked == [True, False]
[email protected](sys.platform == "win32",
- reason="POSIX ownership check; Windows has no st_uid to compare")
[email protected]("posix") # POSIX ownership check; Windows has no st_uid to compare
def test_a_foreign_record_is_not_a_record(tmp_path, monkeypatch, owner_pid):
"""A record this OS user did not write must never decide our lifecycle (forgery/DoS)."""
_publish(owner_pid, tmp_path / "root", ("default", "other"))
diff --git a/tests/gateway/test_host_gateway_lock_refusal.py b/tests/gateway/test_host_gateway_lock_refusal.py
index 73bd8052d03..c0a8e40f228 100644
--- a/tests/gateway/test_host_gateway_lock_refusal.py
+++ b/tests/gateway/test_host_gateway_lock_refusal.py
@@ -34,7 +34,7 @@ def _hold_host_lock_from_another_description(hr):
return handle
[email protected](sys.platform == "win32", reason="flock-based contention setup")
[email protected]("posix") # flock-based contention setup
def test_second_host_gateway_is_refused_with_75_naming_the_owner_and_the_migrate_command(
host_lock_dir, capsys,
):
@@ -61,7 +61,7 @@ def test_second_host_gateway_is_refused_with_75_naming_the_owner_and_the_migrate
assert "--force" in out and "--replace" in out
[email protected](sys.platform == "win32", reason="flock-based contention setup")
[email protected]("posix") # flock-based contention setup
def test_force_still_starts_a_second_gateway_and_an_unusable_lock_dir_is_not_a_refusal(
host_lock_dir, monkeypatch,
):
@@ -85,7 +85,7 @@ def test_force_still_starts_a_second_gateway_and_an_unusable_lock_dir_is_not_a_r
_claim_host_gateway_role() # no SystemExit
[email protected](sys.platform == "win32", reason="flock-based contention setup")
[email protected]("posix") # flock-based contention setup
def test_an_unmigrated_standalone_fleet_starts_beside_the_owner_instead_of_spinning(
host_lock_dir, monkeypatch, caplog,
):
@@ -131,7 +131,7 @@ def test_an_unmigrated_standalone_fleet_starts_beside_the_owner_instead_of_spinn
assert MIGRATE_COMMAND in logged, "the bounded outcome must name the command that converges"
[email protected](sys.platform == "win32", reason="flock-based contention setup")
[email protected]("posix") # flock-based contention setup
def test_a_multiplexing_owner_is_still_refused(host_lock_dir, monkeypatch):
"""The carve-out is scoped to an unmigrated fleet: losing the race to a MULTIPLEXER is still
the second-gateway shape, and an owner we cannot interrogate is treated as one."""
diff --git a/tests/gateway/test_host_rendezvous.py b/tests/gateway/test_host_rendezvous.py
index 3cddd99f8dd..2c3e7702935 100644
--- a/tests/gateway/test_host_rendezvous.py
+++ b/tests/gateway/test_host_rendezvous.py
@@ -108,7 +108,7 @@ def test_stale_record_is_never_attachable(host_dir, pid, create_time):
assert hr.read_record(hr.ROLE_SERVE, include_stale=True) is not None
[email protected](sys.platform == "win32", reason="POSIX signal disposition")
[email protected]("posix") # POSIX signal disposition
def test_sigterm_removes_the_record_and_its_live_session_token(host_dir):
"""SIGTERM is the NORMAL stop (systemd stop, docker stop, the update relaunch) and it does not
run ``atexit``: the record outlived its process and the 0600 token kept a LIVE session token
diff --git a/tests/gateway/test_lifecycle_ledger.py b/tests/gateway/test_lifecycle_ledger.py
index cdb07b352bb..de668a19612 100644
--- a/tests/gateway/test_lifecycle_ledger.py
+++ b/tests/gateway/test_lifecycle_ledger.py
@@ -67,7 +67,7 @@ def _exit_diag_records(home: Path) -> list[dict]:
# ---------------------------------------------------------------------------
[email protected](sys.platform != "linux", reason="/proc is Linux-only")
[email protected]("linux") # /proc is Linux-only
def test_sample_memory_has_expected_keys_on_linux() -> None:
sample = sample_memory()
assert sample.get("rss_kib", 0) > 0
diff --git a/tests/gateway/test_pairing.py b/tests/gateway/test_pairing.py
index f97bfcb3cf7..a5b1146c230 100644
--- a/tests/gateway/test_pairing.py
+++ b/tests/gateway/test_pairing.py
@@ -88,10 +88,7 @@ class TestProfileScopedDiscovery:
class TestSaveJsonFile:
- @pytest.mark.skipif(
- sys.platform.startswith("win"),
- reason="POSIX file modes are not enforced on Windows",
- )
+ @pytest.mark.platforms("posix") # POSIX file modes are not enforced on Windows
def test_sets_file_permissions(self, tmp_path):
target = tmp_path / "secret.json"
_save_json_file(target, {"data": 1})
diff --git a/tests/gateway/test_telegram_closewait_windows_live.py b/tests/gateway/test_telegram_closewait_windows_live.py
index ac09e545572..70d4c4850bf 100644
--- a/tests/gateway/test_telegram_closewait_windows_live.py
+++ b/tests/gateway/test_telegram_closewait_windows_live.py
@@ -56,10 +56,7 @@ if sys.platform == "win32":
pytestmark = [
pytest.mark.asyncio,
- pytest.mark.skipif(
- sys.platform != "win32",
- reason="Windows-only live probe: CLOSE-WAIT reconnect behavior (#87057)",
- ),
+ pytest.mark.platforms("windows"), # Windows-only live probe: CLOSE-WAIT reconnect behavior (#87057)
]
diff --git a/tests/hermes_cli/test_auth_toctou_file_modes.py b/tests/hermes_cli/test_auth_toctou_file_modes.py
index 084f3dea639..e399fa9de91 100644
--- a/tests/hermes_cli/test_auth_toctou_file_modes.py
+++ b/tests/hermes_cli/test_auth_toctou_file_modes.py
@@ -25,10 +25,7 @@ import sys
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform.startswith("win"),
- reason="POSIX mode bits not enforced on Windows",
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX mode bits not enforced on Windows
# ---------------------------------------------------------------------------
diff --git a/tests/hermes_cli/test_backup.py b/tests/hermes_cli/test_backup.py
index e03dba7cca4..9e50c32763d 100644
--- a/tests/hermes_cli/test_backup.py
+++ b/tests/hermes_cli/test_backup.py
@@ -633,7 +633,7 @@ class TestImport:
- @pytest.mark.skipif(os.name != "posix", reason="POSIX file permissions only")
+ @pytest.mark.platforms("posix") # POSIX file permissions only
def test_restores_secret_files_with_0600_perms(self, tmp_path, monkeypatch):
"""Secret files must end up at 0600 after restore (zipfile drops mode bits)."""
hermes_home = tmp_path / ".hermes"
@@ -991,7 +991,7 @@ class TestImportAtomicWrites:
assert (honcho / "config.json").read_text() == original
assert list(honcho.glob(".config.json.*")) == []
- @pytest.mark.skipif(os.name != "posix", reason="POSIX symlinks")
+ @pytest.mark.platforms("posix") # POSIX symlinks
def test_symlinked_target_keeps_its_symlink(self, tmp_path, monkeypatch):
"""A symlinked target is written through, not replaced by a regular file.
@@ -1020,7 +1020,7 @@ class TestImportAtomicWrites:
assert link.is_symlink(), "import replaced the symlink with a regular file"
assert real.read_text() == "model: restored\n"
- @pytest.mark.skipif(os.name != "posix", reason="POSIX symlinks")
+ @pytest.mark.platforms("posix") # POSIX symlinks
def test_symlinked_external_target_keeps_its_symlink(self, tmp_path, monkeypatch):
"""Same guard on the `_external/` branch — the realistic dotfiles case."""
dst_home = tmp_path / "dst"
@@ -1051,7 +1051,7 @@ class TestImportAtomicWrites:
assert link.is_symlink(), "import replaced the symlink with a regular file"
assert real.read_text() == '{"peer":"restored"}'
- @pytest.mark.skipif(os.name != "posix", reason="POSIX file modes")
+ @pytest.mark.platforms("posix") # POSIX file modes
def test_restore_preserves_existing_file_mode(self, tmp_path, monkeypatch):
"""Staging through mkstemp must not silently tighten restored files to 0600.
diff --git a/tests/hermes_cli/test_backup_import_deleted_holder.py b/tests/hermes_cli/test_backup_import_deleted_holder.py
index 5c85fbc63a9..14bf7d57891 100644
--- a/tests/hermes_cli/test_backup_import_deleted_holder.py
+++ b/tests/hermes_cli/test_backup_import_deleted_holder.py
@@ -19,9 +19,7 @@ import pytest
from hermes_cli import backup_restore as backup_mod
-pytestmark = pytest.mark.skipif(
- not sys.platform.startswith("linux"), reason="/proc holder scan is Linux-only"
-)
+pytestmark = pytest.mark.platforms("linux") # /proc holder scan is Linux-only
_HOLDER = (
"import sqlite3, sys, time\n"
diff --git a/tests/hermes_cli/test_backup_stability.py b/tests/hermes_cli/test_backup_stability.py
index e7e583c8fab..e7ba0f070e8 100644
--- a/tests/hermes_cli/test_backup_stability.py
+++ b/tests/hermes_cli/test_backup_stability.py
@@ -85,7 +85,7 @@ def test_quick_snapshot_is_published_with_manifest(tmp_path, monkeypatch) -> Non
assert manifest["files"] == {"config.yaml": 10}
[email protected](os.name == "nt", reason="POSIX permission bits")
[email protected]("posix") # POSIX permission bits
def test_quick_snapshot_tree_is_owner_only_under_permissive_umask(tmp_path) -> None:
"""Recovery snapshots must never inherit world-readable default modes.
diff --git a/tests/hermes_cli/test_boot_bootstrap.py b/tests/hermes_cli/test_boot_bootstrap.py
index e83b9ca7807..22488f18e87 100644
--- a/tests/hermes_cli/test_boot_bootstrap.py
+++ b/tests/hermes_cli/test_boot_bootstrap.py
@@ -151,9 +151,7 @@ def test_record_paths_key_on_install_root(tmp_path, monkeypatch):
assert a.name == b.name # the profile filename is the shared part
- os.name == "nt", reason="requires symlink privilege on Windows"
-)
[email protected]("posix") # requires symlink privilege on Windows
def test_symlinked_root_canonicalizes(tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(tmp_path / "home"))
real = tmp_path / "real-install"
diff --git a/tests/hermes_cli/test_bounded_probe_run.py b/tests/hermes_cli/test_bounded_probe_run.py
index d2ea846f11b..b8e091c538d 100644
--- a/tests/hermes_cli/test_bounded_probe_run.py
+++ b/tests/hermes_cli/test_bounded_probe_run.py
@@ -100,7 +100,7 @@ def test_bounded_git_probe_delegates_same_contract():
assert bounded_git_probe(["definitely-not-a-real-binary-87134"], timeout=5) == ""
[email protected](sys.platform == "win32", reason="POSIX process-group check")
[email protected]("posix") # POSIX process-group check
def test_posix_child_gets_own_process_group():
"""POSIX spawns use process_group=0 so timeout cleanup can killpg the
whole tree (same contract bounded_git_probe had)."""
diff --git a/tests/hermes_cli/test_bundled_desktop_launch.py b/tests/hermes_cli/test_bundled_desktop_launch.py
index dcc23873f28..046fa08c075 100644
--- a/tests/hermes_cli/test_bundled_desktop_launch.py
+++ b/tests/hermes_cli/test_bundled_desktop_launch.py
@@ -107,11 +107,7 @@ def _host_bundle(tmp_path: Path) -> tuple[Path, Path]:
class TestResolveBundleLayout:
- @pytest.mark.skipif(
- sys.platform == "win32",
- reason="POSIX-only: the Linux launcher rule reads execute bits, "
- "which os.access reports as always-set on Windows",
- )
+ @pytest.mark.platforms("posix") # POSIX-only: the Linux launcher rule reads execute bits, which os.access reports as always-set on Windows
def test_linux_launcher_is_the_one_non_helper_executable(self, tmp_path):
repo = _linux_bundle(tmp_path)
layout = resolve_bundle_layout(repo, platform="linux")
diff --git a/tests/hermes_cli/test_chat_q_exit_clear.py b/tests/hermes_cli/test_chat_q_exit_clear.py
index aa0fd08b7de..0cc86438cff 100644
--- a/tests/hermes_cli/test_chat_q_exit_clear.py
+++ b/tests/hermes_cli/test_chat_q_exit_clear.py
@@ -171,7 +171,7 @@ def _fallback_cli():
return SimpleNamespace(), ExplodingStdout()
[email protected](os.name == "nt", reason="POSIX `clear` path; the nt path has its own test")
[email protected]("posix") # POSIX `clear` path; the nt path has its own test
def test_clear_fallback_spawns_no_shell(monkeypatch):
"""#116904: fallback used os.system() — a shell spawn (console flash on Windows,
silent no-op without `clear`). It must now be an argv subprocess.run of the
@@ -214,7 +214,7 @@ def test_clear_fallback_windows_runs_cls_with_hidden_console(monkeypatch):
assert calls == [(["cmd", "/c", "cls"], {"stdin": sp.DEVNULL, "creationflags": sp.CREATE_NO_WINDOW, "check": False})]
[email protected](os.name == "nt", reason="POSIX `clear` lookup")
[email protected]("posix") # POSIX `clear` lookup
def test_clear_fallback_skips_spawn_when_no_clear(monkeypatch):
"""POSIX without `clear` on PATH: skip the spawn entirely instead of letting a
shell swallow the failure (#116904's silent no-op)."""
diff --git a/tests/hermes_cli/test_cli_light_mode.py b/tests/hermes_cli/test_cli_light_mode.py
index 55846cdb467..9f03dd039e4 100644
--- a/tests/hermes_cli/test_cli_light_mode.py
+++ b/tests/hermes_cli/test_cli_light_mode.py
@@ -402,7 +402,7 @@ def repo_root():
return pathlib.Path(__file__).resolve().parents[2]
[email protected](_sys.platform == "win32", reason="POSIX PTY test")
[email protected]("posix") # POSIX PTY test
class TestOsc11Da1Fence:
def test_herdr_style_da1_only_returns_none_without_leak(self, repo_root):
"""Terminal answers DA1 instantly but swallows OSC 11 (herdr)."""
diff --git a/tests/hermes_cli/test_cpr_local_leak.py b/tests/hermes_cli/test_cpr_local_leak.py
index 37340e8d295..db2f01ad4bc 100644
--- a/tests/hermes_cli/test_cpr_local_leak.py
+++ b/tests/hermes_cli/test_cpr_local_leak.py
@@ -57,7 +57,7 @@ def _openpty_or_skip():
pytest.skip(f"no PTY devices available: {exc}")
[email protected](sys.platform == "win32", reason="POSIX PTY harness")
[email protected]("posix") # POSIX PTY harness
class TestDelayedCprLocalPtyLeak:
def test_delayed_cpr_reply_leaks_when_enable_cpr_true(self):
"""Local (no SSH) delayed ESC[6n reply lands as ESC[39;1R on stdin."""
diff --git a/tests/hermes_cli/test_cross_profile_kill_refusal.py b/tests/hermes_cli/test_cross_profile_kill_refusal.py
index 64d35d3db86..a2e3b55e68d 100644
--- a/tests/hermes_cli/test_cross_profile_kill_refusal.py
+++ b/tests/hermes_cli/test_cross_profile_kill_refusal.py
@@ -98,7 +98,7 @@ class TestRecordedGatewayHomeConflicts:
# The lookalike's argv ("<stub> gateway run") is what the guard's real-gateway spawn check matches;
# the child is a sleep stub the test kills in ``finally``, never a runtime.
@pytest.mark.spawns_gateway_lookalike
[email protected](sys.platform == "win32", reason="POSIX flock harness")
[email protected]("posix") # POSIX flock harness
class TestCrossProfileStopRefusal:
def test_stop_profile_gateway_refuses_other_profiles_pid(
self, tmp_path, monkeypatch
@@ -167,7 +167,7 @@ class TestCrossProfileStopRefusal:
@pytest.mark.spawns_gateway_lookalike
[email protected](sys.platform == "win32", reason="POSIX flock harness")
[email protected]("posix") # POSIX flock harness
class TestProfileDeleteStopRefusal:
def test_stop_gateway_process_refuses_other_profiles_pid(
self, tmp_path, capsys
diff --git a/tests/hermes_cli/test_dashboard_procs_kill_grace.py b/tests/hermes_cli/test_dashboard_procs_kill_grace.py
index f8d7b661495..c11e5654e77 100644
--- a/tests/hermes_cli/test_dashboard_procs_kill_grace.py
+++ b/tests/hermes_cli/test_dashboard_procs_kill_grace.py
@@ -27,7 +27,7 @@ from hermes_cli import dashboard_procs
_REPO_ROOT = pathlib.Path(dashboard_procs.__file__).resolve().parents[1]
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="POSIX signal semantics only")
+pytestmark = pytest.mark.platforms("posix") # POSIX signal semantics only
# Mirrors the lifespan: sleep for the teardown budget on SIGTERM, then leave a marker and exit 0.
_GRACEFUL_CHILD = textwrap.dedent(
diff --git a/tests/hermes_cli/test_desktop_lifecycle_windows_live.py b/tests/hermes_cli/test_desktop_lifecycle_windows_live.py
index 36301976057..93cf20d0846 100644
--- a/tests/hermes_cli/test_desktop_lifecycle_windows_live.py
+++ b/tests/hermes_cli/test_desktop_lifecycle_windows_live.py
@@ -26,9 +26,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform != "win32", reason="live Windows lifecycle E2E"
-)
+pytestmark = pytest.mark.platforms("windows") # live Windows lifecycle E2E
PROJECT_ROOT = Path(__file__).resolve().parents[2]
diff --git a/tests/hermes_cli/test_doctor_journal_modes.py b/tests/hermes_cli/test_doctor_journal_modes.py
index 15f61397197..f3d65dffc14 100644
--- a/tests/hermes_cli/test_doctor_journal_modes.py
+++ b/tests/hermes_cli/test_doctor_journal_modes.py
@@ -144,7 +144,7 @@ class TestReadJournalMode:
finally:
holder.close()
- @pytest.mark.skipif(os.name == "nt", reason="chmod is a no-op on Windows")
+ @pytest.mark.platforms("posix") # chmod is a no-op on Windows
@pytest.mark.skipif(hasattr(os, "geteuid") and os.geteuid() == 0, reason="root ignores file permissions")
def test_read_only_directory_is_still_readable(self, tmp_path):
db = tmp_path / "state.db"
@@ -286,7 +286,7 @@ class TestUnreadableReason:
assert "No such file or directory" in reason
- @pytest.mark.skipif(os.name == "nt", reason="chmod is a no-op on Windows")
+ @pytest.mark.platforms("posix") # chmod is a no-op on Windows
@pytest.mark.skipif(
# os.geteuid is POSIX-only, and a skipif condition is evaluated at
# collection time — calling it unguarded would raise AttributeError
@@ -403,7 +403,7 @@ class TestReportDatabaseJournalModes:
out = capsys.readouterr().out
assert "state.db: rollback journal mode" in out
- @pytest.mark.skipif(os.name == "nt", reason="chmod is a no-op on Windows")
+ @pytest.mark.platforms("posix") # chmod is a no-op on Windows
@pytest.mark.skipif(hasattr(os, "geteuid") and os.geteuid() == 0, reason="root ignores file permissions")
def test_unreadable_database_does_not_crash(self, tmp_path, capsys):
db = tmp_path / "state.db"
@@ -465,7 +465,7 @@ class TestConfiguredDeleteNeverApplied:
assert "state.db: WAL journal mode" not in out
assert ("To clear the exposure:" in out) is exposed
- @pytest.mark.skipif(sys.platform == "win32", reason="holder scan has no Windows backend")
+ @pytest.mark.platforms("posix") # holder scan has no Windows backend
def test_wal_db_under_configured_delete_names_its_holders(self, tmp_path, capsys, monkeypatch):
# The offline conversion needs the file quiet, so doctor must say WHICH process to stop — a
# subprocess holding a real connection is named by PID; the doctor process itself is not a holder.
diff --git a/tests/hermes_cli/test_ensure_hermes_home_uid.py b/tests/hermes_cli/test_ensure_hermes_home_uid.py
index 0978ede900e..aa08261e0b1 100644
--- a/tests/hermes_cli/test_ensure_hermes_home_uid.py
+++ b/tests/hermes_cli/test_ensure_hermes_home_uid.py
@@ -111,7 +111,7 @@ class TestChownToHermesUid:
class TestSecureDirChown:
- @pytest.mark.skipif(sys.platform == "win32", reason="chown is no-op on Windows")
+ @pytest.mark.platforms("posix") # chown is no-op on Windows
def test_secure_dir_invokes_chown_when_env_set(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_UID", "1000")
monkeypatch.setenv("HERMES_GID", "911")
@@ -124,7 +124,7 @@ class TestSecureDirChown:
cfg._secure_dir(d)
mock_chown.assert_called_once_with(d, 1000, 911)
- @pytest.mark.skipif(sys.platform == "win32", reason="chown is no-op on Windows")
+ @pytest.mark.platforms("posix") # chown is no-op on Windows
def test_secure_dir_no_chown_when_env_unset(self, tmp_path, monkeypatch):
monkeypatch.delenv("HERMES_UID", raising=False)
monkeypatch.delenv("HERMES_GID", raising=False)
diff --git a/tests/hermes_cli/test_exit_watchdog_signal_arm.py b/tests/hermes_cli/test_exit_watchdog_signal_arm.py
index cb7a05ea178..6654caef122 100644
--- a/tests/hermes_cli/test_exit_watchdog_signal_arm.py
+++ b/tests/hermes_cli/test_exit_watchdog_signal_arm.py
@@ -102,7 +102,7 @@ while True:
"""
[email protected](sys.platform == "win32", reason="POSIX signals")
[email protected]("posix") # POSIX signals
def test_sigterm_on_wedged_process_forces_exit_within_leash():
"""E2E: a wedged process armed via the signal path self-exits at ~2×
HERMES_EXIT_WATCHDOG_S; without the signal it would live forever."""
@@ -137,7 +137,7 @@ def test_sigterm_on_wedged_process_forces_exit_within_leash():
p.kill()
[email protected](sys.platform == "win32", reason="POSIX signals")
[email protected]("posix") # POSIX signals
def test_signal_watchdog_is_skipped_once_cleanup_starts():
"""If cleanup starts after signal intent, the cleanup-owned watchdog should
govern shutdown and the signal watchdog should not hard-kill midway."""
diff --git a/tests/hermes_cli/test_fleet_config_migration_windows_live.py b/tests/hermes_cli/test_fleet_config_migration_windows_live.py
index 34ae8b35e34..3e0c01b2a87 100644
--- a/tests/hermes_cli/test_fleet_config_migration_windows_live.py
+++ b/tests/hermes_cli/test_fleet_config_migration_windows_live.py
@@ -12,7 +12,7 @@ import hermes_yaml as yaml
WORKTREE = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(WORKTREE))
-pytestmark = pytest.mark.skipif(sys.platform != "win32", reason="live Windows E2E")
+pytestmark = pytest.mark.platforms("windows") # live Windows E2E
def test_fleet_config_migration_live_windows(tmp_path, monkeypatch):
diff --git a/tests/hermes_cli/test_gateway.py b/tests/hermes_cli/test_gateway.py
index cd922f70080..b1c1b3d9834 100644
--- a/tests/hermes_cli/test_gateway.py
+++ b/tests/hermes_cli/test_gateway.py
@@ -163,7 +163,7 @@ def test_windows_gateway_start_diag_reports_detach_state(
[email protected](sys.platform == "win32", reason="POSIX PTY coverage")
[email protected]("posix") # POSIX PTY coverage
@pytest.mark.parametrize(
("stdin_is_tty", "outcome", "expected_exit"),
[
@@ -359,10 +359,7 @@ def test_spawn_detached_gateway_timestamps_stderr(monkeypatch, tmp_path):
assert kwargs["stdout"].name == str(tmp_path / "logs" / "gateway.log")
- sys.platform == "win32",
- reason="systemd user-linger is Linux-only (drives os.getuid())",
-)
[email protected]("posix") # systemd user-linger is Linux-only (drives os.getuid())
def test_systemd_install_checks_linger_status(monkeypatch, tmp_path, capsys):
unit_path = tmp_path / "systemd" / "user" / "hermes-gateway.service"
diff --git a/tests/hermes_cli/test_gateway_job_teardown_live.py b/tests/hermes_cli/test_gateway_job_teardown_live.py
index 44c772b98d6..2c97f51a71e 100644
--- a/tests/hermes_cli/test_gateway_job_teardown_live.py
+++ b/tests/hermes_cli/test_gateway_job_teardown_live.py
@@ -37,10 +37,7 @@ from pathlib import Path
import pytest
-pytestmark = [
- pytest.mark.platforms("windows"),
- pytest.mark.skipif(sys.platform != "win32", reason="native Windows only"),
-]
+pytestmark = pytest.mark.platforms("windows") # native Windows only
_REPO_ROOT = Path(__file__).resolve().parents[2]
diff --git a/tests/hermes_cli/test_git_probe_tree_kill.py b/tests/hermes_cli/test_git_probe_tree_kill.py
index 464616fd465..a308c8dd69d 100644
--- a/tests/hermes_cli/test_git_probe_tree_kill.py
+++ b/tests/hermes_cli/test_git_probe_tree_kill.py
@@ -22,9 +22,7 @@ import pytest
from hermes_cli import _subprocess_compat
from hermes_cli._subprocess_compat import bounded_git_probe, kill_process_tree
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX process-group semantics"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX process-group semantics
def _write_forking_script(tmp_path, marker_name="child.pid"):
diff --git a/tests/hermes_cli/test_git_trampoline_windows_live.py b/tests/hermes_cli/test_git_trampoline_windows_live.py
index e0ace04f0f6..4421bf5e5aa 100644
--- a/tests/hermes_cli/test_git_trampoline_windows_live.py
+++ b/tests/hermes_cli/test_git_trampoline_windows_live.py
@@ -20,9 +20,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform != "win32", reason="live Windows trampoline E2E"
-)
+pytestmark = pytest.mark.platforms("windows") # live Windows trampoline E2E
_FORK_BOMB_BAT = (
"@echo off\r\n"
diff --git a/tests/hermes_cli/test_gui_uninstall.py b/tests/hermes_cli/test_gui_uninstall.py
index 12a1f7956a1..d9c0332b4fc 100644
--- a/tests/hermes_cli/test_gui_uninstall.py
+++ b/tests/hermes_cli/test_gui_uninstall.py
@@ -126,7 +126,7 @@ def test_uninstall_skips_cache_refresh_when_no_launcher_entry(tmp_path, monkeypa
assert refreshed == []
[email protected](sys.platform == "win32", reason="POSIX symlink semantics")
[email protected]("posix") # POSIX symlink semantics
def test_remove_path_handles_symlink(tmp_path):
target = tmp_path / "real"
target.mkdir()
diff --git a/tests/hermes_cli/test_linux_desktop_entry.py b/tests/hermes_cli/test_linux_desktop_entry.py
index 5345536f5de..f6b303af958 100644
--- a/tests/hermes_cli/test_linux_desktop_entry.py
+++ b/tests/hermes_cli/test_linux_desktop_entry.py
@@ -781,10 +781,7 @@ def test_exec_arg_quoting_handles_spaces(tmp_path, xdg_home, monkeypatch):
assert exec_line == f'"{spaced}" desktop'
- sys.platform == "win32", reason="Symlinks require elevated privileges on Windows"
-)
[email protected]("linux") # symlinks; Windows needs elevated privileges for them
def test_running_interpreter_keeps_venv_semantic_path(tmp_path, monkeypatch):
"""Lexical preserved only when pyvenv.cfg marks the path as a venv."""
# venv layout: bin/python symlink -> base, pyvenv.cfg at venv root
@@ -912,10 +909,7 @@ def test_wrapper_ownership_rejects_sibling_extensions(suffix, tmp_path):
assert lde._wrapper_targets_checkout(evil, checkout) is False
- sys.platform == "win32", reason="Symlinks require elevated privileges on Windows"
-)
[email protected]("linux") # symlinks; Windows needs elevated privileges for them
def test_wrapper_ownership_accepts_shim_via_symlinked_home(tmp_path, monkeypatch):
"""Installer writes $INSTALL_DIR lexically; the root stays lexical too.
diff --git a/tests/hermes_cli/test_mcp_helper_ledger.py b/tests/hermes_cli/test_mcp_helper_ledger.py
index 74f766a4291..27867dcece9 100644
--- a/tests/hermes_cli/test_mcp_helper_ledger.py
+++ b/tests/hermes_cli/test_mcp_helper_ledger.py
@@ -24,9 +24,7 @@ import pytest
from hermes_cli import process_identity as pi
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="uses POSIX sleep children"
-)
+pytestmark = pytest.mark.platforms("posix") # uses POSIX sleep children
@pytest.fixture
diff --git a/tests/hermes_cli/test_memory_setup_env_denylist.py b/tests/hermes_cli/test_memory_setup_env_denylist.py
index 97fe4d55e74..6d7ed4810fa 100644
--- a/tests/hermes_cli/test_memory_setup_env_denylist.py
+++ b/tests/hermes_cli/test_memory_setup_env_denylist.py
@@ -171,7 +171,7 @@ def test_value_with_embedded_newline_is_stripped():
assert "EVIL" not in _env_file_keys()
[email protected](os.name == "nt", reason="POSIX mode bits not enforced on Windows")
[email protected]("posix") # POSIX mode bits not enforced on Windows
def test_env_file_created_with_secure_permissions(tmp_path):
"""Regression guard for the TOCTOU window the direct ``Path.write_text``
+ post-hoc ``chmod`` implementation had: ``save_env_value`` creates the
diff --git a/tests/hermes_cli/test_migrate_xai.py b/tests/hermes_cli/test_migrate_xai.py
index c85bdeb0606..519be352050 100644
--- a/tests/hermes_cli/test_migrate_xai.py
+++ b/tests/hermes_cli/test_migrate_xai.py
@@ -271,7 +271,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")
+ @pytest.mark.platforms("posix") # 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."""
diff --git a/tests/hermes_cli/test_plan_reconciliation_windows_live.py b/tests/hermes_cli/test_plan_reconciliation_windows_live.py
index 86a8e768f8e..345407c5507 100644
--- a/tests/hermes_cli/test_plan_reconciliation_windows_live.py
+++ b/tests/hermes_cli/test_plan_reconciliation_windows_live.py
@@ -19,7 +19,7 @@ sys.path.insert(0, str(WORKTREE))
import pytest
-pytestmark = pytest.mark.skipif(sys.platform != "win32", reason="live Windows E2E")
+pytestmark = pytest.mark.platforms("windows") # live Windows E2E
def test_plan_reconciliation_live_windows(tmp_path, monkeypatch):
diff --git a/tests/hermes_cli/test_plugin_private_repo_auth.py b/tests/hermes_cli/test_plugin_private_repo_auth.py
index 7f4179fb914..941831df356 100644
--- a/tests/hermes_cli/test_plugin_private_repo_auth.py
+++ b/tests/hermes_cli/test_plugin_private_repo_auth.py
@@ -172,7 +172,7 @@ def test_ref_fetch_and_update_pull_attach_credential_only_after_anonymous_refusa
assert attempts == ([[], [f"Authorization: basic {expected}"]] if outcome == "refused" else [[]])
[email protected](sys.platform == "win32", reason="POSIX shell askpass stub + local HTTP server")
[email protected]("posix") # POSIX shell askpass stub + local HTTP server
def test_anonymous_attempt_fails_fast_under_inherited_askpass(tmp_path, monkeypatch):
"""With an inherited ``GIT_ASKPASS`` (VS Code terminal, ksshaskpass) the anonymous attempt
against a remote answering 401 must still fail fast with the classifiable "could not read
@@ -220,7 +220,7 @@ def test_anonymous_attempt_fails_fast_under_inherited_askpass(tmp_path, monkeypa
assert all("GIT_ASKPASS" not in env for env in attempts)
[email protected](sys.platform == "win32", reason="POSIX shell stub credential helper")
[email protected]("posix") # POSIX shell stub credential helper
def test_credential_fill_uses_stored_helper_and_never_prompts(tmp_path, monkeypatch):
helper = tmp_path / "helper.sh"
helper.write_text("#!/bin/sh\n[ \"$1\" = get ] && printf 'username=bob\\npassword=pw-from-helper\\n'\n", encoding="utf-8")
diff --git a/tests/hermes_cli/test_plugins_cmd_list.py b/tests/hermes_cli/test_plugins_cmd_list.py
index 885337b653e..618d1592250 100644
--- a/tests/hermes_cli/test_plugins_cmd_list.py
+++ b/tests/hermes_cli/test_plugins_cmd_list.py
@@ -132,7 +132,7 @@ def test_declared_capabilities_for_entrypoint_uses_distribution_metadata(
]
[email protected](os.name == "nt", reason="chmod is a no-op on Windows")
[email protected]("posix") # chmod is a no-op on Windows
@pytest.mark.skipif(getattr(os, "geteuid", lambda: 1)() == 0, reason="root ignores file permissions")
def test_unreadable_plugin_dir_is_skipped_by_every_manifest_scan(monkeypatch, tmp_path, caplog):
"""One plugin directory the process cannot stat() into (Windows WinError 5, POSIX mode 000)
diff --git a/tests/hermes_cli/test_post_update_adoption.py b/tests/hermes_cli/test_post_update_adoption.py
index c1f2dfd7383..47137940566 100644
--- a/tests/hermes_cli/test_post_update_adoption.py
+++ b/tests/hermes_cli/test_post_update_adoption.py
@@ -81,10 +81,8 @@ def test_sealed_tree_untouched(tmp_path, monkeypatch):
assert not (root / "install-stamp.json").exists()
- sys.platform == "win32" or os.geteuid() == 0,
- reason="chmod-based read-only dirs are not enforceable on Windows or as root",
-)
[email protected](getattr(os, "geteuid", lambda: 1)() == 0, reason='chmod-based read-only dirs are not enforceable on Windows or as root')
def test_read_only_tree_fails_soft(blessed_checkout):
"""nix-like read-only tree: debug-log skip, never a crash."""
mode = stat.S_IMODE(os.stat(blessed_checkout).st_mode)
diff --git a/tests/hermes_cli/test_profile_distribution.py b/tests/hermes_cli/test_profile_distribution.py
index c30fdeb6ba3..6da9bb06a21 100644
--- a/tests/hermes_cli/test_profile_distribution.py
+++ b/tests/hermes_cli/test_profile_distribution.py
@@ -830,9 +830,7 @@ 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"
- )
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_existing_file_mode_is_preserved(self, tmp_path):
import os
import stat
@@ -846,9 +844,7 @@ class TestManifestCrashDurability:
mode = stat.S_IMODE(mf.stat().st_mode)
assert mode == 0o644, f"mode changed to {oct(mode)}"
- @pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX permission bits"
- )
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_created_file_mode_is_not_tightened(self, tmp_path):
"""A manifest this function *creates* must not land owner-only.
diff --git a/tests/hermes_cli/test_profile_export_special_files.py b/tests/hermes_cli/test_profile_export_special_files.py
index d1c7618ae71..182785811af 100644
--- a/tests/hermes_cli/test_profile_export_special_files.py
+++ b/tests/hermes_cli/test_profile_export_special_files.py
@@ -17,10 +17,7 @@ import pytest
from hermes_cli.profiles import export_profile
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32",
- reason="Unix sockets and FIFOs are not available on Windows",
-)
+pytestmark = pytest.mark.platforms("posix") # Unix sockets and FIFOs are not available on Windows
def _patch_named_profile(monkeypatch, profiles_root, profile_dir):
diff --git a/tests/hermes_cli/test_pty_bridge.py b/tests/hermes_cli/test_pty_bridge.py
index dee89071dd3..590e6dbbbda 100644
--- a/tests/hermes_cli/test_pty_bridge.py
+++ b/tests/hermes_cli/test_pty_bridge.py
@@ -22,9 +22,7 @@ pytest.importorskip("ptyprocess", reason="ptyprocess not installed")
from hermes_cli.pty_bridge import PtyBridge, PtyUnavailableError
-skip_on_windows = pytest.mark.skipif(
- sys.platform.startswith("win"), reason="PTY bridge is POSIX-only"
-)
+skip_on_windows = pytest.mark.platforms("posix") # PTY bridge is POSIX-only
def _read_until(bridge: PtyBridge, needle: bytes, timeout: float = 5.0) -> bytes:
diff --git a/tests/hermes_cli/test_relay_shared_metrics.py b/tests/hermes_cli/test_relay_shared_metrics.py
index 15864299829..349dacba796 100644
--- a/tests/hermes_cli/test_relay_shared_metrics.py
+++ b/tests/hermes_cli/test_relay_shared_metrics.py
@@ -1528,7 +1528,7 @@ def test_schema_initialization_waits_for_an_existing_writer(tmp_path):
assert store.counter_snapshot() == []
[email protected](os.name == "nt", reason="POSIX permission modes are unavailable")
[email protected]("posix") # POSIX permission modes are unavailable
def test_store_and_export_are_owner_only(tmp_path):
database_path = tmp_path / "private-store" / "metrics.sqlite3"
outbox_directory = tmp_path / "private-outbox"
diff --git a/tests/hermes_cli/test_serve_port_in_use.py b/tests/hermes_cli/test_serve_port_in_use.py
index aa67816ee8f..1f60a9d7a94 100644
--- a/tests/hermes_cli/test_serve_port_in_use.py
+++ b/tests/hermes_cli/test_serve_port_in_use.py
@@ -28,9 +28,7 @@ import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX serve-runner path under test"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX serve-runner path under test
# ---------------------------------------------------------------------------
diff --git a/tests/hermes_cli/test_session_recovery_lost_and_found.py b/tests/hermes_cli/test_session_recovery_lost_and_found.py
index c20c21c3158..f4504bc8ab4 100644
--- a/tests/hermes_cli/test_session_recovery_lost_and_found.py
+++ b/tests/hermes_cli/test_session_recovery_lost_and_found.py
@@ -1183,7 +1183,7 @@ def test_recovery_lane_refuses_to_verify_when_rows_matched_no_layout(
# ── .recover stderr pipe must be drained while the child runs ──────────────
[email protected](sys.platform == "win32", reason="stub sqlite3 is a /bin/sh script")
[email protected]("posix") # stub sqlite3 is a /bin/sh script
def test_recover_attempts_survive_dump_stderr_beyond_pipe_buffer(tmp_path: Path) -> None:
"""A heavily damaged source makes ``.recover`` emit per-page diagnostics on
stderr. Past the OS pipe buffer (~64KB) an undrained stderr blocks the dump
diff --git a/tests/hermes_cli/test_sessions_held_store_gate.py b/tests/hermes_cli/test_sessions_held_store_gate.py
index 76762cd8d69..b70d369e151 100644
--- a/tests/hermes_cli/test_sessions_held_store_gate.py
+++ b/tests/hermes_cli/test_sessions_held_store_gate.py
@@ -15,7 +15,7 @@ import pytest
import hermes_cli.sessions_cmd as sessions_cmd
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="holder scan is unavailable on Windows")
+pytestmark = pytest.mark.platforms("posix") # holder scan is unavailable on Windows
_HOLDER = (
diff --git a/tests/hermes_cli/test_sessions_set_journal_mode.py b/tests/hermes_cli/test_sessions_set_journal_mode.py
index 44588a13b21..25166737148 100644
--- a/tests/hermes_cli/test_sessions_set_journal_mode.py
+++ b/tests/hermes_cli/test_sessions_set_journal_mode.py
@@ -47,8 +47,7 @@ def test_set_journal_mode_converts_wal_store_offline(tmp_path, monkeypatch, caps
assert "wal → delete" in capsys.readouterr().out
[email protected](sys.platform == "win32",
- reason="foreign_state_db_holders has no Windows scan; the --force refusal covers that lane")
[email protected]("posix") # foreign_state_db_holders has no Windows scan; the --force refusal covers that lane
def test_set_journal_mode_refuses_while_another_process_holds_the_store(tmp_path, monkeypatch, capsys):
db = tmp_path / "state.db"
_wal_store(db)
diff --git a/tests/hermes_cli/test_signal_handler_kanban_worker.py b/tests/hermes_cli/test_signal_handler_kanban_worker.py
index 2b9ba4dd3d7..db5d7598375 100644
--- a/tests/hermes_cli/test_signal_handler_kanban_worker.py
+++ b/tests/hermes_cli/test_signal_handler_kanban_worker.py
@@ -154,10 +154,7 @@ def _cleanup(proc: subprocess.Popen) -> None:
proc.kill()
- sys.platform == "win32",
- reason="SIGTERM semantics differ on Windows; kanban dispatcher is POSIX-only",
-)
[email protected]("posix") # SIGTERM semantics differ on Windows; kanban dispatcher is POSIX-only
def test_sigterm_with_kanban_task_env_terminates_quickly():
"""With HERMES_KANBAN_TASK set, SIGTERM should kill the process in <2s
even when a non-daemon thread is still alive."""
@@ -183,10 +180,7 @@ def test_sigterm_with_kanban_task_env_terminates_quickly():
_cleanup(proc)
- sys.platform == "win32",
- reason="SIGTERM semantics differ on Windows; kanban dispatcher is POSIX-only",
-)
[email protected]("posix") # SIGTERM semantics differ on Windows; kanban dispatcher is POSIX-only
def test_sigterm_without_kanban_task_env_uses_keyboard_interrupt_path():
"""Without HERMES_KANBAN_TASK, the original KeyboardInterrupt path runs.
diff --git a/tests/hermes_cli/test_sqlite_runtime.py b/tests/hermes_cli/test_sqlite_runtime.py
index 85ef61fc112..615dda5e804 100644
--- a/tests/hermes_cli/test_sqlite_runtime.py
+++ b/tests/hermes_cli/test_sqlite_runtime.py
@@ -54,7 +54,7 @@ def test_probe_reports_the_requested_interpreters_linked_sqlite() -> None:
assert info.sqlite_source_id == source_id
[email protected](os.name == "nt", reason="uses a POSIX executable probe stub")
[email protected]("posix") # uses a POSIX executable probe stub
def test_probe_uses_child_payload_and_sanitizes_python_environment(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
diff --git a/tests/hermes_cli/test_ssh_session_token_parser.py b/tests/hermes_cli/test_ssh_session_token_parser.py
index 734f69f57b6..0c58bfddd55 100644
--- a/tests/hermes_cli/test_ssh_session_token_parser.py
+++ b/tests/hermes_cli/test_ssh_session_token_parser.py
@@ -33,10 +33,7 @@ def test_serve_help_advertises_secure_ssh_bootstrap_flags(capsys):
- os.name == "nt",
- reason="POSIX fixture uses mode bits; Windows read_token requires protected DACLs",
-)
[email protected]("posix") # POSIX fixture uses mode bits; Windows read_token requires protected DACLs
def test_token_file_is_read_and_unlinked_through_private_directory(tmp_path, monkeypatch):
home = tmp_path / "home"
monkeypatch.setenv("HOME", str(home))
@@ -54,7 +51,7 @@ def test_token_file_is_read_and_unlinked_through_private_directory(tmp_path, mon
reset_hermes_home_override(override)
[email protected](os.name == "nt", reason="POSIX desktop-ssh token path")
[email protected]("posix") # POSIX desktop-ssh token path
def test_token_anchor_is_os_home_not_active_profile(tmp_path, monkeypatch):
"""Regression for #69551: the Desktop client always writes the token under
``$HOME/.hermes/desktop-ssh`` (a literal ``~/.hermes/desktop-ssh`` in
@@ -82,7 +79,7 @@ def test_token_anchor_is_os_home_not_active_profile(tmp_path, monkeypatch):
reset_hermes_home_override(override)
[email protected](os.name == "nt", reason="POSIX desktop-ssh token path")
[email protected]("posix") # POSIX desktop-ssh token path
def test_token_under_profile_desktop_ssh_is_rejected(tmp_path, monkeypatch):
"""The client never writes under a profile-scoped desktop-ssh dir, so a token
placed there must be rejected even while that profile is active — proving the
@@ -103,7 +100,7 @@ def test_token_under_profile_desktop_ssh_is_rejected(tmp_path, monkeypatch):
reset_hermes_home_override(override)
[email protected](os.name == "nt", reason="POSIX symlink contract")
[email protected]("posix") # POSIX symlink contract
def test_token_file_rejects_symlink(tmp_path, monkeypatch):
home = tmp_path / "home"
monkeypatch.setenv("HOME", str(home))
diff --git a/tests/hermes_cli/test_stale_pid_guard.py b/tests/hermes_cli/test_stale_pid_guard.py
index 649d17bf73c..70cbd7be8b3 100644
--- a/tests/hermes_cli/test_stale_pid_guard.py
+++ b/tests/hermes_cli/test_stale_pid_guard.py
@@ -106,7 +106,7 @@ class TestPidIsHermes:
):
assert _subprocess_compat.pid_is_hermes(1234) is False
- @pytest.mark.skipif(sys.platform != "win32", reason="real probe is windows-only")
+ @pytest.mark.platforms("windows") # real probe is windows-only
def test_missing_pid_real_probe_fails_closed(self):
# A PID that cannot exist must never be judged Hermes-owned.
assert _subprocess_compat.pid_is_hermes(2**24) is False
@@ -209,7 +209,7 @@ def test_stop_only_targets_the_invoking_hermes_home(monkeypatch):
class TestHermesHomeForPid:
"""Tri-state owner resolution: a readable environment always names a home."""
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX default home is $HOME/.hermes")
+ @pytest.mark.platforms("posix") # POSIX default home is $HOME/.hermes
def test_readable_env_without_var_resolves_to_that_process_default_home(self, monkeypatch, tmp_path):
"""The common install shape exports no HERMES_HOME: the backend lives in its user's
platform default home, and a default-home ``--stop`` must still find it (#113978)."""
diff --git a/tests/hermes_cli/test_stderr_timestamp.py b/tests/hermes_cli/test_stderr_timestamp.py
index c408aae608b..ef01c7d3ab0 100644
--- a/tests/hermes_cli/test_stderr_timestamp.py
+++ b/tests/hermes_cli/test_stderr_timestamp.py
@@ -219,7 +219,7 @@ def test_main_maps_gateway_ex_config_to_clean_stop(tmp_path):
[email protected](sys.platform == "win32", reason="POSIX signals")
[email protected]("posix") # POSIX signals
def test_wrapper_forwards_sigusr1_restart_request_to_child(tmp_path):
"""Regression for #101426: launchd owns the wrapper's PID, so ``hermes update`` sends its
drain-aware SIGUSR1 to the wrapper. It must reach the gateway child and the wrapper must
diff --git a/tests/hermes_cli/test_taskkill_identity_windows_live.py b/tests/hermes_cli/test_taskkill_identity_windows_live.py
index 11002aece6e..cffd627fba6 100644
--- a/tests/hermes_cli/test_taskkill_identity_windows_live.py
+++ b/tests/hermes_cli/test_taskkill_identity_windows_live.py
@@ -19,9 +19,7 @@ import time
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform != "win32", reason="live taskkill-identity probes are Windows-only"
-)
+pytestmark = pytest.mark.platforms("windows") # live taskkill-identity probes are Windows-only
def _spawn_sleeper(seconds: int = 60) -> subprocess.Popen:
diff --git a/tests/hermes_cli/test_uninstall_shell_configs.py b/tests/hermes_cli/test_uninstall_shell_configs.py
index d19831c5451..1e443fe07ad 100644
--- a/tests/hermes_cli/test_uninstall_shell_configs.py
+++ b/tests/hermes_cli/test_uninstall_shell_configs.py
@@ -120,7 +120,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")
+ @pytest.mark.platforms("posix") # 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"
diff --git a/tests/hermes_cli/test_update_eol_churn.py b/tests/hermes_cli/test_update_eol_churn.py
index a8fe2f762f5..a73322734e1 100644
--- a/tests/hermes_cli/test_update_eol_churn.py
+++ b/tests/hermes_cli/test_update_eol_churn.py
@@ -150,7 +150,7 @@ def test_pin_alone_is_written_when_there_is_no_churn(tmp_path: Path) -> None:
assert _autocrlf(repo) == "false"
[email protected](sys.platform == "win32", reason="shim needs a POSIX shell")
[email protected]("posix") # shim needs a POSIX shell
def test_pin_is_withheld_when_the_churn_cannot_be_cleared(tmp_path: Path) -> None:
"""If normalization can't finish, the checkout is left as found — pinning
anyway would surface churn we failed to clear."""
diff --git a/tests/hermes_cli/test_update_flat_install_state_gitignore.py b/tests/hermes_cli/test_update_flat_install_state_gitignore.py
index ce915b99388..9e7d8e5bc0b 100644
--- a/tests/hermes_cli/test_update_flat_install_state_gitignore.py
+++ b/tests/hermes_cli/test_update_flat_install_state_gitignore.py
@@ -188,7 +188,7 @@ def test_untracked_autostash_leaves_open_wal_database_readable(flat_install_repo
conn.close()
[email protected](os.name == "nt", reason="fcntl is POSIX-only")
[email protected]("posix") # fcntl is POSIX-only
def test_untracked_autostash_cannot_split_live_database_lock_inode(flat_install_repo):
"""The updater's real stash step must leave a held ``state.db.quarantine.lock``
on its original inode (#112974). Unlinking a flocked path does not release the
diff --git a/tests/hermes_cli/test_update_secret_import_lock.py b/tests/hermes_cli/test_update_secret_import_lock.py
index fda730996bb..2e99215cc2d 100644
--- a/tests/hermes_cli/test_update_secret_import_lock.py
+++ b/tests/hermes_cli/test_update_secret_import_lock.py
@@ -120,7 +120,7 @@ def test_dotenv_loading_is_preserved_when_external_secrets_are_skipped(
assert applied == ([home] if external_secrets else [])
[email protected](sys.platform == "win32", reason="the 'command' secret source is POSIX-only")
[email protected]("posix") # the 'command' secret source is POSIX-only
def test_update_probe_children_skip_external_secret_sources(tmp_path):
"""The critical-module import probe imports ``run_agent``, whose dotenv load must not run a
configured secret helper: a slow helper (op/bws/command, 120s budget) inside the 120s probe
diff --git a/tests/hermes_cli/test_update_stale_dashboard.py b/tests/hermes_cli/test_update_stale_dashboard.py
index 79c500c84a9..68be0f77d63 100644
--- a/tests/hermes_cli/test_update_stale_dashboard.py
+++ b/tests/hermes_cli/test_update_stale_dashboard.py
@@ -151,7 +151,7 @@ class TestFindStaleDashboardPids:
- @pytest.mark.skipif(sys.platform == "win32", reason="ps-based scan path")
+ @pytest.mark.platforms("posix") # ps-based scan path
def test_self_pid_excluded(self):
with patch("subprocess.run") as mock_run:
mock_run.return_value = MagicMock(
@@ -183,7 +183,7 @@ class TestFindStaleDashboardPids:
[email protected](sys.platform == "win32", reason="POSIX kill semantics")
[email protected]("posix") # POSIX kill semantics
class TestKillStaleDashboardPosix:
"""Kill path on Linux / macOS: SIGTERM then SIGKILL any survivors."""
@@ -385,7 +385,7 @@ class TestWindowsWmicEncoding:
assert _find_stale_dashboard_pids() == []
[email protected](sys.platform == "win32", reason="POSIX kill + systemd restart")
[email protected]("posix") # POSIX kill + systemd restart
class TestSupervisedBackendRestart:
"""After the kill, systemd-supervised PIDs get their owning unit
restarted (#68934) — SIGTERM reads as a clean stop to systemd, so
@@ -454,7 +454,7 @@ class TestManualBackendRespawn:
return main_dashboard
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX cmdline capture + respawn")
+ @pytest.mark.platforms("posix") # POSIX cmdline capture + respawn
def test_argv_capture_failure_falls_back_to_hint(self, capsys):
live = self._live()
@@ -476,7 +476,7 @@ class TestManualBackendRespawn:
out = capsys.readouterr().out
assert "Restart anything not auto-restarted" in out
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX cmdline capture + respawn")
+ @pytest.mark.platforms("posix") # POSIX cmdline capture + respawn
def test_non_orphan_fixed_port_still_respawns(self, capsys):
"""A supervised-by-shell dashboard with a fixed port is still restarted."""
live = self._live()
@@ -500,7 +500,7 @@ class TestManualBackendRespawn:
respawn.assert_called_once_with([argv])
assert "when you're ready" not in capsys.readouterr().out
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX cmdline capture + respawn")
+ @pytest.mark.platforms("posix") # POSIX cmdline capture + respawn
def test_port_zero_serves_killed_without_respawn(self, capsys):
"""``serve --port 0`` backends are stopped but not resurrected (#78821)."""
live = self._live()
@@ -531,7 +531,7 @@ class TestManualBackendRespawn:
assert result["unrecovered"] == []
assert "when you're ready" not in capsys.readouterr().out
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX cmdline capture + respawn")
+ @pytest.mark.platforms("posix") # POSIX cmdline capture + respawn
def test_detached_fixed_port_still_respawns_after_prior_update(self, capsys):
"""PPID-1 fixed-port backends (prior start_new_session respawn) stay eligible."""
live = self._live()
@@ -809,7 +809,7 @@ class TestCmdlineCapture:
def _live(self):
return main_dashboard
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX /proc cmdline path")
+ @pytest.mark.platforms("posix") # POSIX /proc cmdline path
def test_reads_proc_cmdline_when_available(self, tmp_path, monkeypatch):
live = self._live()
proc_file = tmp_path / "cmdline"
@@ -835,7 +835,7 @@ class TestCmdlineCapture:
assert argv == ["/usr/bin/python3", "-m", "hermes_cli.main", "serve"]
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX ps cmdline fallback")
+ @pytest.mark.platforms("posix") # POSIX ps cmdline fallback
def test_falls_back_to_ps_without_proc(self, monkeypatch):
live = self._live()
@@ -921,7 +921,7 @@ class TestLaunchdSupervisedBackends:
result = _kill_stale_dashboard_processes(restart_managed=restart_managed)
return result, restart, respawn
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX cmdline capture + respawn")
+ @pytest.mark.platforms("posix") # POSIX cmdline capture + respawn
def test_launchd_owned_backend_restarts_through_launchd_never_as_a_detached_respawn(self, capsys):
"""The reporter's state: the job is loaded but has no live process (it keeps failing on the
port) and a detached copy runs its exact ProgramArguments. The copy is stopped and the JOB
diff --git a/tests/hermes_cli/test_update_wedged_gateway.py b/tests/hermes_cli/test_update_wedged_gateway.py
index bf56ae1b9d5..b703ed3e326 100644
--- a/tests/hermes_cli/test_update_wedged_gateway.py
+++ b/tests/hermes_cli/test_update_wedged_gateway.py
@@ -31,19 +31,6 @@ from gateway.shutdown_watchdog import (
write_loop_heartbeat,
)
-# Native Windows exposes neither ``socket.AF_UNIX`` nor an asyncio UNIX
-# server, so the witness cases that create real socket nodes
-# (``_silent_socket_node``) or run the real producer
-# (``loop_heartbeat_forever``) cannot execute there. Only those cases are
-# skipped: the witness-absent contracts (mocked probes, file-only
-# heartbeats) are platform-independent and keep running on Windows, per
-# the Windows behavior pinned alongside the product-side guarantee.
-_NEEDS_UNIX_SOCKETS = pytest.mark.skipif(
- sys.platform == "win32",
- reason="requires real UNIX-domain sockets "
- "(socket.AF_UNIX / asyncio.start_unix_server), unavailable on native Windows",
-)
-
@pytest.fixture()
def tmp_path():
@@ -500,7 +487,6 @@ class TestLoopTickWitness:
witnesses agree the loop stopped scheduling.
"""
- @_NEEDS_UNIX_SOCKETS
def test_stalled_heartbeat_write_never_escalates_a_running_loop(
self, tmp_path, monkeypatch
):
@@ -650,7 +636,6 @@ class TestLoopTickWitness:
thread.join(timeout=5.0)
assert not errors, errors
- @_NEEDS_UNIX_SOCKETS
def test_off_loop_completion_cannot_manufacture_fresh_liveness(self, tmp_path):
"""A write landing after the loop froze must not look alive.
@@ -670,7 +655,6 @@ class TestLoopTickWitness:
== gateway_cli.GATEWAY_LOOP_UNKNOWN
)
- @_NEEDS_UNIX_SOCKETS
def test_true_wedge_requires_sustained_witness_silence(self, tmp_path):
"""Stale file + armed socket silent across the whole window: WEDGED.
@@ -830,7 +814,6 @@ class TestLoopTickWitness:
== gateway_cli.GATEWAY_LOOP_WEDGED
)
- @_NEEDS_UNIX_SOCKETS
def test_legacy_fresh_file_with_dead_node_is_unknown(self, tmp_path):
"""A fresh legacy file stays safe under a dead-listener node.
@@ -848,7 +831,6 @@ class TestLoopTickWitness:
== gateway_cli.GATEWAY_LOOP_UNKNOWN
)
- @_NEEDS_UNIX_SOCKETS
@pytest.mark.asyncio
async def test_producer_rebinds_over_stale_socket_node(self, tmp_path):
"""A leftover node from a dead process must not disarm the witness.
@@ -890,7 +872,6 @@ class TestLoopTickWitness:
except asyncio.CancelledError:
pass
- @_NEEDS_UNIX_SOCKETS
def test_transient_stall_below_wedge_budget_never_escalates(
self, tmp_path, monkeypatch
):
@@ -943,7 +924,6 @@ class TestLoopTickWitness:
state["thread"].join(timeout=5.0)
assert not errors, errors
- @_NEEDS_UNIX_SOCKETS
def test_sustained_stop_above_wedge_budget_still_escalates(
self, tmp_path
):
diff --git a/tests/hermes_cli/test_web_profile_soul_writes.py b/tests/hermes_cli/test_web_profile_soul_writes.py
index 63b01586a68..d01f6ce87f4 100644
--- a/tests/hermes_cli/test_web_profile_soul_writes.py
+++ b/tests/hermes_cli/test_web_profile_soul_writes.py
@@ -104,7 +104,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")
+ @pytest.mark.platforms("posix") # 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."""
@@ -118,7 +118,7 @@ class TestSoulWriteDurability:
mode = stat.S_IMODE(soul.stat().st_mode)
assert mode == 0o644, f"mode changed to {oct(mode)}"
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_created_file_mode_is_not_tightened(self, client, profile_dir: Path):
"""The first-ever Save must not leave SOUL.md owner-only.
diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py
index 78d263af97d..d60c55ecc84 100644
--- a/tests/hermes_cli/test_web_server.py
+++ b/tests/hermes_cli/test_web_server.py
@@ -4904,9 +4904,7 @@ import sys
from hermes_cli import main_tui_launch
-skip_on_windows = pytest.mark.skipif(
- sys.platform.startswith("win"), reason="PTY bridge is POSIX-only"
-)
+skip_on_windows = pytest.mark.platforms("posix") # PTY bridge is POSIX-only
@skip_on_windows
diff --git a/tests/hermes_cli/test_web_server_auto_archive_gateway_lock.py b/tests/hermes_cli/test_web_server_auto_archive_gateway_lock.py
index fdbd9315c1d..95a0f22a751 100644
--- a/tests/hermes_cli/test_web_server_auto_archive_gateway_lock.py
+++ b/tests/hermes_cli/test_web_server_auto_archive_gateway_lock.py
@@ -19,9 +19,7 @@ import pytest
from hermes_cli.profiles import _check_gateway_running
from hermes_cli import web_server_sessions as wss
-pytestmark = pytest.mark.skipif(
- sys.platform.startswith("win"), reason="POSIX flock holder"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX flock holder
_HOLDER = (
"import fcntl, sys, time\n"
diff --git a/tests/hermes_cli/test_web_server_idle_proof.py b/tests/hermes_cli/test_web_server_idle_proof.py
index bb8b5908a91..6b4a42c9655 100644
--- a/tests/hermes_cli/test_web_server_idle_proof.py
+++ b/tests/hermes_cli/test_web_server_idle_proof.py
@@ -103,7 +103,7 @@ def test_queued_prompts_and_unwinding_workers_are_not_idle(monkeypatch):
# Live children: three real desktop-shaped ``serve`` processes, one held busy
# ---------------------------------------------------------------------------
-pytestmark_live = pytest.mark.skipif(sys.platform == "win32", reason="POSIX serve-runner path under test")
+pytestmark_live = pytest.mark.platforms("posix") # POSIX serve-runner path under test
TOKEN = "idle-proof-live-token"
diff --git a/tests/hermes_cli/test_web_server_pty_import.py b/tests/hermes_cli/test_web_server_pty_import.py
index b8787af7f28..b74cebf2fb3 100644
--- a/tests/hermes_cli/test_web_server_pty_import.py
+++ b/tests/hermes_cli/test_web_server_pty_import.py
@@ -35,7 +35,7 @@ def test_web_server_exposes_pty_bridge_symbols():
assert issubclass(_web_server_chat.PtyUnavailableError, BaseException)
[email protected](sys.platform.startswith("win"), reason="POSIX-only")
[email protected]("posix") # POSIX-only
def test_web_server_uses_posix_pty_bridge_on_posix():
"""On POSIX, the bridge must be the fcntl/termios PtyBridge."""
from hermes_cli.pty_bridge import PtyBridge as PosixBridge
diff --git a/tests/hermes_cli/test_web_server_pty_reconnect.py b/tests/hermes_cli/test_web_server_pty_reconnect.py
index e6c0f3ae5bb..a3b8224afe6 100644
--- a/tests/hermes_cli/test_web_server_pty_reconnect.py
+++ b/tests/hermes_cli/test_web_server_pty_reconnect.py
@@ -9,9 +9,7 @@ import pytest
import hermes_cli.web_server_chat as _web_server_chat
-pytestmark = pytest.mark.skipif(
- sys.platform.startswith("win"), reason="PTY bridge is POSIX-only"
-)
+pytestmark = pytest.mark.platforms("posix") # PTY bridge is POSIX-only
class _OneFrameBridge:
diff --git a/tests/hermes_cli/test_webhook_cli.py b/tests/hermes_cli/test_webhook_cli.py
index 0ac55bce7c9..3fba3ecfb11 100644
--- a/tests/hermes_cli/test_webhook_cli.py
+++ b/tests/hermes_cli/test_webhook_cli.py
@@ -170,7 +170,7 @@ class TestPersistence:
path.write_text("broken{{{")
assert _load_subscriptions() == {}
- @pytest.mark.skipif(os.name == "nt", reason="POSIX mode bits are platform-specific")
+ @pytest.mark.platforms("posix") # POSIX mode bits are platform-specific
def test_save_creates_secret_file_owner_only_under_permissive_umask(self):
old_umask = os.umask(0o022)
try:
@@ -182,7 +182,7 @@ class TestPersistence:
assert stat.S_IMODE(path.stat().st_mode) == 0o600
assert "TOPSECRET" in path.read_text(encoding="utf-8")
- @pytest.mark.skipif(os.name == "nt", reason="POSIX mode bits are platform-specific")
+ @pytest.mark.platforms("posix") # POSIX mode bits are platform-specific
def test_save_narrows_existing_broad_secret_file_mode(self):
# Simulate a pre-existing 0o644 file from before this hardening landed.
path = _subscriptions_path()
diff --git a/tests/hermes_cli/test_win_pty_bridge.py b/tests/hermes_cli/test_win_pty_bridge.py
index 3d4269b1527..41eda8ef20e 100644
--- a/tests/hermes_cli/test_win_pty_bridge.py
+++ b/tests/hermes_cli/test_win_pty_bridge.py
@@ -202,7 +202,7 @@ class TestWinPtyBridgeUnavailable:
proc.release_write.set()
assert any("thread leaked" in r.getMessage() for r in caplog.records)
- @pytest.mark.skipif(sys.platform.startswith("win"), reason="non-Windows only")
+ @pytest.mark.platforms("posix") # non-Windows only
def test_spawn_raises_unavailable_off_windows(self):
with pytest.raises(PtyUnavailableError):
WinPtyBridge.spawn(["true"])
diff --git a/tests/hermes_state/test_auto_vacuum_holder_gate.py b/tests/hermes_state/test_auto_vacuum_holder_gate.py
index 68b93482f75..f74f6644d3c 100644
--- a/tests/hermes_state/test_auto_vacuum_holder_gate.py
+++ b/tests/hermes_state/test_auto_vacuum_holder_gate.py
@@ -11,7 +11,7 @@ import sys
import pytest
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="holder scan is unavailable on Windows")
+pytestmark = pytest.mark.platforms("posix") # holder scan is unavailable on Windows
_HOLDER = (
"import sqlite3, sys\n"
diff --git a/tests/hermes_state/test_deleted_wal_generation_guard.py b/tests/hermes_state/test_deleted_wal_generation_guard.py
index ec855404530..3af4dbcf177 100644
--- a/tests/hermes_state/test_deleted_wal_generation_guard.py
+++ b/tests/hermes_state/test_deleted_wal_generation_guard.py
@@ -89,10 +89,7 @@ def test_delete_journal_two_writers_still_work(tmp_path, monkeypatch):
a.close()
- not sys.platform.startswith("linux"),
- reason="deleted-WAL /proc scan is Linux-only",
-)
[email protected]("linux") # deleted-WAL /proc scan is Linux-only
def test_iter_finds_self_after_wal_unlink(tmp_path, force_wal):
path = tmp_path / "state.db"
db = make_db(path, "s", "held")
@@ -162,10 +159,7 @@ def test_iter_finds_holder_when_db_file_itself_is_symlink(tmp_path):
conn.close()
- not sys.platform.startswith("linux"),
- reason="deleted-WAL /proc scan is Linux-only",
-)
[email protected]("linux") # deleted-WAL /proc scan is Linux-only
def test_second_sessiondb_open_refuses_and_does_not_mint_wal(tmp_path, force_wal):
path = tmp_path / "state.db"
writer = make_db(path, "s", "before-unlink")
@@ -184,10 +178,7 @@ def test_second_sessiondb_open_refuses_and_does_not_mint_wal(tmp_path, force_wal
writer.close()
- not sys.platform.startswith("linux"),
- reason="deleted-WAL /proc scan is Linux-only",
-)
[email protected]("linux") # deleted-WAL /proc scan is Linux-only
def test_iter_holders_ignores_live_unhashed_dentry(tmp_path, force_wal, monkeypatch):
"""OpenZFS can report a live, still-linked file's /proc fd target with the
`` (deleted)`` suffix (dentry unhashed, nlink still 1) even though nothing
@@ -237,10 +228,7 @@ def test_iter_holders_ignores_descriptor_closed_during_scan(tmp_path, monkeypatc
assert iter_deleted_sqlite_sidecar_holders(path) == []
- not sys.platform.startswith("linux"),
- reason="deleted-WAL write halt uses Linux unlink semantics",
-)
[email protected]("linux") # deleted-WAL write halt uses Linux unlink semantics
def test_write_path_ignores_live_unhashed_dentry(tmp_path, force_wal, monkeypatch):
"""Same OpenZFS artifact as above, but on the sticky in-process write-path
probe (_wal_generation_was_lost), which the open-path fix alone does not cover."""
@@ -267,10 +255,7 @@ def test_write_path_ignores_live_unhashed_dentry(tmp_path, force_wal, monkeypatc
db.close()
- not sys.platform.startswith("linux"),
- reason="deleted-WAL /proc scan is Linux-only",
-)
[email protected]("linux") # deleted-WAL /proc scan is Linux-only
def test_iter_holders_flags_orphan_kept_alive_by_hardlink(tmp_path, force_wal):
"""`st_nlink == 0` is not proof of an orphan either: a stale generation can keep a
surviving hard link (a backup, an operator copy) after the watched path itself is
@@ -294,10 +279,7 @@ def test_iter_holders_flags_orphan_kept_alive_by_hardlink(tmp_path, force_wal):
db.close()
- not sys.platform.startswith("linux"),
- reason="deleted-WAL write halt uses Linux unlink semantics",
-)
[email protected]("linux") # deleted-WAL write halt uses Linux unlink semantics
def test_writer_halts_after_own_wal_unlinked(tmp_path, force_wal):
path = tmp_path / "state.db"
db = make_db(path, "s", "before")
@@ -509,10 +491,7 @@ def test_renamed_wal_generation_survives_close_and_clean_process_exit(tmp_path):
_assert_new_generation_survives_retirement_and_exit(tmp_path, rename_sidecars=True)
- not sys.platform.startswith("linux"),
- reason="deleted-WAL /proc scan is Linux-only",
-)
[email protected]("linux") # deleted-WAL /proc scan is Linux-only
def test_refuse_helper_raises_while_deleted_wal_held(tmp_path, force_wal):
path = tmp_path / "state.db"
raw = sqlite3.connect(str(path))
diff --git a/tests/hermes_state/test_fts_rebuild_admission.py b/tests/hermes_state/test_fts_rebuild_admission.py
index 7604071aa07..4fbca604deb 100644
--- a/tests/hermes_state/test_fts_rebuild_admission.py
+++ b/tests/hermes_state/test_fts_rebuild_admission.py
@@ -30,9 +30,7 @@ import hermes_state_common
from hermes_state import SessionDB
from hermes_state_common import FTS_STALE_KEY, _FTS_TRIGGERS
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX flock child-process harness"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX flock child-process harness
_HOLD_LOCK_SCRIPT = """
diff --git a/tests/hermes_state/test_hermes_state.py b/tests/hermes_state/test_hermes_state.py
index a959c51ce11..27146e9da92 100644
--- a/tests/hermes_state/test_hermes_state.py
+++ b/tests/hermes_state/test_hermes_state.py
@@ -121,7 +121,7 @@ def _no_fts_rebuild_throttle(monkeypatch):
class TestConnectionLifecycle:
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_writable_state_db_is_owner_only_under_permissive_umask(self, tmp_path):
"""state.db and any live SQLite sidecars must not inherit 0644 modes."""
db_path = tmp_path / "state.db"
@@ -150,7 +150,7 @@ class TestConnectionLifecycle:
finally:
session_db.close()
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_writable_state_db_tightens_existing_loose_mode(self, tmp_path):
"""Opening a legacy 0644 profile store repairs it in place."""
db_path = tmp_path / "state.db"
@@ -164,7 +164,7 @@ class TestConnectionLifecycle:
finally:
session_db.close()
- @pytest.mark.skipif(os.name == "nt", reason="POSIX fcntl locks")
+ @pytest.mark.platforms("posix") # POSIX fcntl locks
def test_writable_state_db_keeps_locks_across_second_open(self, tmp_path):
"""Opening a second SessionDB in this process must not unlink live sidecars.
diff --git a/tests/hermes_state/test_hermes_state_readonly_preflight.py b/tests/hermes_state/test_hermes_state_readonly_preflight.py
index c532b16f6b5..e40874e13d8 100644
--- a/tests/hermes_state/test_hermes_state_readonly_preflight.py
+++ b/tests/hermes_state/test_hermes_state_readonly_preflight.py
@@ -26,7 +26,7 @@ import hermes_state
from hermes_state import SessionDB, preflight_db_writability
pytestmark = [
- pytest.mark.skipif(sys.platform == "win32", reason="POSIX chmod semantics"),
+ pytest.mark.platforms("posix"), # POSIX chmod semantics
pytest.mark.skipif(
hasattr(os, "geteuid") and os.geteuid() == 0,
reason="root bypasses file permission checks",
diff --git a/tests/hermes_state/test_retired_wal_generation_capture.py b/tests/hermes_state/test_retired_wal_generation_capture.py
index e767f51db32..c9cb9e3612c 100644
--- a/tests/hermes_state/test_retired_wal_generation_capture.py
+++ b/tests/hermes_state/test_retired_wal_generation_capture.py
@@ -28,7 +28,7 @@ from tests.hermes_state._wal_generation_harness import (
)
FD_DIRECTORY = "/proc/self/fd" if sys.platform.startswith("linux") else "/dev/fd"
-not_windows = pytest.mark.skipif(sys.platform == "win32", reason="a held sidecar cannot be unlinked on Windows")
+not_windows = pytest.mark.platforms("posix") # a held sidecar cannot be unlinked on Windows
@pytest.fixture
diff --git a/tests/hermes_state/test_state_db_lock_fail_closed.py b/tests/hermes_state/test_state_db_lock_fail_closed.py
index ecbe1286467..06bf8f8ed36 100644
--- a/tests/hermes_state/test_state_db_lock_fail_closed.py
+++ b/tests/hermes_state/test_state_db_lock_fail_closed.py
@@ -136,7 +136,7 @@ def test_repair_lock_fails_closed_when_lock_file_is_unopenable(tmp_path):
assert holding is False
[email protected](sys.platform == "win32", reason="writable_schema corruption harness")
[email protected]("posix") # writable_schema corruption harness
def test_repair_skips_surgery_when_lock_file_is_unopenable(tmp_path):
"""Behavior: no writable_schema surgery, no forensic backup, DB untouched.
diff --git a/tests/hermes_state/test_state_db_malformed_repair.py b/tests/hermes_state/test_state_db_malformed_repair.py
index 14d5aa43e7b..63cb36e9c5a 100644
--- a/tests/hermes_state/test_state_db_malformed_repair.py
+++ b/tests/hermes_state/test_state_db_malformed_repair.py
@@ -461,7 +461,7 @@ def _lock_held_by_other_process(db_path: Path, hold_seconds: float = 30.0):
proc.wait(timeout=10)
[email protected](sys.platform == "win32", reason="POSIX flock test")
[email protected]("posix") # POSIX flock test
def test_repair_skips_surgery_while_another_process_holds_the_lock(
tmp_path, monkeypatch
):
@@ -482,7 +482,7 @@ def test_repair_skips_surgery_while_another_process_holds_the_lock(
assert hermes_state_repair._db_opens_cleanly(db_path) is not None
[email protected](sys.platform == "win32", reason="POSIX flock test")
[email protected]("posix") # POSIX flock test
def test_repair_reports_success_when_the_holder_already_healed_the_db(
tmp_path, monkeypatch
):
@@ -517,7 +517,7 @@ def _release_header_probe_fds() -> None:
hermes_state_dbfile._HEADER_PROBE_FDS.clear()
[email protected](sys.platform == "win32", reason="POSIX flock test")
[email protected]("posix") # POSIX flock test
def test_two_processes_repairing_at_once_perform_surgery_once(tmp_path):
"""Concurrent repairers serialise; the loser sees a healed DB and stops.
diff --git a/tests/honcho_plugin/test_session.py b/tests/honcho_plugin/test_session.py
index 5534e24d025..ce53bd97696 100644
--- a/tests/honcho_plugin/test_session.py
+++ b/tests/honcho_plugin/test_session.py
@@ -1370,7 +1370,7 @@ class TestInjectionAuditLog:
path = _provider_with_raw({"logging": value})._injection_log_path
assert path is not None and path.endswith("injection.log")
- @pytest.mark.skipif(os.name == "nt", reason="POSIX file modes")
+ @pytest.mark.platforms("posix") # POSIX file modes
def test_log_file_is_owner_only(self, tmp_path):
provider = _provider_with_raw({})
provider._injection_log_path = str(tmp_path / "injection.log")
diff --git a/tests/plugins/memory/test_hindsight_env_perms.py b/tests/plugins/memory/test_hindsight_env_perms.py
index f956106c854..a68e678f694 100644
--- a/tests/plugins/memory/test_hindsight_env_perms.py
+++ b/tests/plugins/memory/test_hindsight_env_perms.py
@@ -30,7 +30,7 @@ _CONFIG = {
}
[email protected](os.name == "nt", reason="POSIX mode bits are not enforced on Windows")
[email protected]("posix") # POSIX mode bits are not enforced on Windows
def test_fresh_profile_env_is_owner_only_despite_permissive_umask():
old_umask = os.umask(0o022)
try:
@@ -47,7 +47,7 @@ def test_fresh_profile_env_is_owner_only_despite_permissive_umask():
)
[email protected](os.name == "nt", reason="POSIX mode bits are not enforced on Windows")
[email protected]("posix") # POSIX mode bits are not enforced on Windows
def test_rewrite_tightens_existing_world_readable_profile_env():
profile_env = _embedded_profile_env_path(_CONFIG)
profile_env.parent.mkdir(parents=True)
@@ -62,7 +62,7 @@ def test_rewrite_tightens_existing_world_readable_profile_env():
)
[email protected](os.name == "nt", reason="POSIX mode bits are not enforced on Windows")
[email protected]("posix") # POSIX mode bits are not enforced on Windows
def test_secret_file_removed_when_permission_validation_fails(monkeypatch):
"""If the post-write permission check cannot verify 0600, the plaintext
key file must not be left behind."""
@@ -81,7 +81,7 @@ def test_secret_file_removed_when_permission_validation_fails(monkeypatch):
)
[email protected](os.name == "nt", reason="POSIX mode bits are not enforced on Windows")
[email protected]("posix") # POSIX mode bits are not enforced on Windows
def test_scopeless_worker_reuses_on_disk_key(monkeypatch):
"""Durability core: with no secret scope, the key resolves from disk.
diff --git a/tests/plugins/memory/test_hindsight_provider.py b/tests/plugins/memory/test_hindsight_provider.py
index 0659473faa5..093d4f4bebc 100644
--- a/tests/plugins/memory/test_hindsight_provider.py
+++ b/tests/plugins/memory/test_hindsight_provider.py
@@ -1566,7 +1566,7 @@ class TestSharedEventLoopLifecycle:
assert provider._client is None
[email protected](os.name == "nt", reason="POSIX mode bits not enforced on Windows")
[email protected]("posix") # POSIX mode bits not enforced on Windows
def test_save_config_sets_owner_only_permissions(tmp_path):
"""hindsight/config.json must be written with 0o600 so API key is not world-readable."""
provider = HindsightMemoryProvider()
diff --git a/tests/plugins/memory/test_openviking_provider.py b/tests/plugins/memory/test_openviking_provider.py
index 3d7a059bb9d..b1ba2c13ad7 100644
--- a/tests/plugins/memory/test_openviking_provider.py
+++ b/tests/plugins/memory/test_openviking_provider.py
@@ -1222,7 +1222,7 @@ class _HungThread:
# ---------------------------------------------------------------------------
[email protected](os.name == "nt", reason="POSIX advisory locks")
[email protected]("posix") # POSIX advisory locks
@pytest.mark.parametrize("owner_run_id", ["dead-owner", ""])
def test_concurrent_providers_claim_unlocked_pending_owner_once(
tmp_path,
diff --git a/tests/plugins/memory/test_supermemory_provider.py b/tests/plugins/memory/test_supermemory_provider.py
index 6ee70790bae..4543831fa19 100644
--- a/tests/plugins/memory/test_supermemory_provider.py
+++ b/tests/plugins/memory/test_supermemory_provider.py
@@ -615,7 +615,7 @@ def test_post_setup_writes_config_and_prints_summary(monkeypatch, tmp_path, caps
assert "Memory provider: supermemory" in out
[email protected](os.name == "nt", reason="POSIX mode bits not enforced on Windows")
[email protected]("posix") # POSIX mode bits not enforced on Windows
def test_save_config_sets_owner_only_permissions(tmp_path):
"""supermemory.json must be written with 0o600 so API key is not world-readable."""
_save_supermemory_config({"api_key": "sm-test-key"}, str(tmp_path))
diff --git a/tests/plugins/platforms/photon/test_auth.py b/tests/plugins/platforms/photon/test_auth.py
index 9a650e58300..6735192c40f 100644
--- a/tests/plugins/platforms/photon/test_auth.py
+++ b/tests/plugins/platforms/photon/test_auth.py
@@ -75,7 +75,7 @@ def test_store_and_load_photon_token(tmp_hermes_home: Path) -> None:
assert auth_json["credential_pool"]["photon"][0]["access_token"] == "abc123def456"
[email protected](os.name != "posix", reason="POSIX mode bits only")
[email protected]("posix") # POSIX mode bits only
def test_save_auth_never_world_readable(tmp_hermes_home: Path) -> None:
"""auth.json must be created 0o600 — no window at process umask."""
photon_auth.store_photon_token("secret-token")
diff --git a/tests/plugins/platforms/photon/test_runtime_record.py b/tests/plugins/platforms/photon/test_runtime_record.py
index 37d270e5ed6..03bba08710d 100644
--- a/tests/plugins/platforms/photon/test_runtime_record.py
+++ b/tests/plugins/platforms/photon/test_runtime_record.py
@@ -59,7 +59,7 @@ def test_write_read_delete_roundtrip(record_path: Path) -> None:
assert photon_adapter._read_runtime_record() is None
[email protected](sys.platform == "win32", reason="POSIX permission bits")
[email protected]("posix") # POSIX permission bits
def test_record_written_with_0600(record_path: Path) -> None:
photon_adapter._write_runtime_record(8789, "secret", 1)
mode = stat.S_IMODE(record_path.stat().st_mode)
diff --git a/tests/plugins/test_honcho_client_config.py b/tests/plugins/test_honcho_client_config.py
index 695da505dee..f434c2bdebe 100644
--- a/tests/plugins/test_honcho_client_config.py
+++ b/tests/plugins/test_honcho_client_config.py
@@ -71,7 +71,7 @@ class TestHonchoClientConfigAutoEnable:
[email protected](os.name == "nt", reason="POSIX mode bits not enforced on Windows")
[email protected]("posix") # POSIX mode bits not enforced on Windows
def test_save_config_sets_owner_only_permissions(tmp_path, monkeypatch):
"""honcho.json is created atomically with 0o600, not chmod-after-write."""
import utils
diff --git a/tests/pm/test_archive_safety.py b/tests/pm/test_archive_safety.py
index 34fbc8c7bbb..7619c3b9d31 100644
--- a/tests/pm/test_archive_safety.py
+++ b/tests/pm/test_archive_safety.py
@@ -29,12 +29,8 @@ import pytest
from pm.store import extract, flatten_single_dir
-posix_only = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX symlink/mode semantics"
-)
-win_only = pytest.mark.skipif(
- sys.platform != "win32", reason="pins win32 degradation specifically"
-)
+posix_only = pytest.mark.platforms("posix") # POSIX symlink/mode semantics
+win_only = pytest.mark.platforms("windows") # pins win32 degradation specifically
def _tar(path: Path, members: dict[str, bytes]) -> Path:
diff --git a/tests/scripts/test_run_tests_parallel.py b/tests/scripts/test_run_tests_parallel.py
index 0a387efd783..4e583cfc4fa 100644
--- a/tests/scripts/test_run_tests_parallel.py
+++ b/tests/scripts/test_run_tests_parallel.py
@@ -456,7 +456,7 @@ def test_drive_letter_colon_is_not_a_path_separator(tmp_path: Path) -> None:
assert "Discovered 1 test files" in proc.stdout, proc.stdout
[email protected](sys.platform == "win32", reason="POSIX signal death; Windows has no SIGSEGV exit")
[email protected]("posix") # POSIX signal death; Windows has no SIGSEGV exit
def test_interpreter_crash_is_reported_as_a_crash_not_as_no_tests_ran(tmp_path: Path) -> None:
"""A file whose interpreter dies by signal is classified as CRASHED (#113186).
diff --git a/tests/test_atomic_write_text_metadata.py b/tests/test_atomic_write_text_metadata.py
index 701fbb635ca..3ec1ebadb8e 100644
--- a/tests/test_atomic_write_text_metadata.py
+++ b/tests/test_atomic_write_text_metadata.py
@@ -24,9 +24,7 @@ import pytest
from utils import atomic_write_text, atomic_yaml_write
-pytestmark = pytest.mark.skipif(
- sys.platform == "win32", reason="POSIX permission bits"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX permission bits
class TestPreserveMode:
diff --git a/tests/test_credential_file_permissions.py b/tests/test_credential_file_permissions.py
index dd66b190a1e..58ed85c03b1 100644
--- a/tests/test_credential_file_permissions.py
+++ b/tests/test_credential_file_permissions.py
@@ -15,9 +15,7 @@ import pytest
from utils import warn_if_credential_file_broadly_readable
-pytestmark = pytest.mark.skipif(
- os.name != "posix", reason="POSIX permission-bit semantics required"
-)
+pytestmark = pytest.mark.platforms("posix") # POSIX permission-bit semantics required
class TestWarnIfCredentialFileBroadlyReadable:
diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.py
index fcc2d04b4aa..8a3ddfe5c51 100644
--- a/tests/test_hermes_constants.py
+++ b/tests/test_hermes_constants.py
@@ -547,7 +547,7 @@ class TestSecureParentDir:
assert called_with[0] == (str(real_dir), 0o700)
[email protected](os.name == "nt", reason="POSIX shell stubs; Windows uses .cmd shims")
[email protected]("posix") # POSIX shell stubs; Windows uses .cmd shims
class TestAgentBrowserRunnable:
"""agent_browser_runnable() validates the resolved CLI actually runs.
diff --git a/tests/test_scratch_dir.py b/tests/test_scratch_dir.py
index 4d527d0eda4..0aa5ae93495 100644
--- a/tests/test_scratch_dir.py
+++ b/tests/test_scratch_dir.py
@@ -58,7 +58,7 @@ def test_prune_removes_only_stale_top_level_entries(tmp_path):
assert not stale.exists() and fresh.exists()
[email protected](sys.platform == "win32", reason="POSIX directory modes")
[email protected]("posix") # POSIX directory modes
class TestScratchDirPermissionPolicy:
"""get_scratch_dir must honor the home permission policy instead of a blanket 0700:
an explicit HERMES_HOME_MODE and a managed/shared home win (#117347)."""
@@ -165,7 +165,7 @@ class TestScratchDirPermissionPolicy:
mock_chown.assert_called_once_with(tmp_path / "cache" / "scratch", 1000, 911)
[email protected](sys.platform == "win32", reason="POSIX file modes")
[email protected]("posix") # POSIX file modes
def test_config_and_constants_share_one_policy_implementation(tmp_path, monkeypatch):
"""hermes_constants is the single home of managed / container / HERMES_UID policy: config
re-exports it (no keep-in-sync twins), so _secure_file skips on the same canonical container
diff --git a/tests/tools/environments/test_local_path_completion.py b/tests/tools/environments/test_local_path_completion.py
index 6593855b468..4677f381f65 100644
--- a/tests/tools/environments/test_local_path_completion.py
+++ b/tests/tools/environments/test_local_path_completion.py
@@ -13,7 +13,7 @@ import pytest
from tools.environments import local as local_mod
from tools.environments.local import _append_missing_sane_path_entries, _make_run_env
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="POSIX PATH completion only")
+pytestmark = pytest.mark.platforms("posix") # POSIX PATH completion only
def test_existing_user_local_bin_appended_after_inherited_entries(monkeypatch, tmp_path):
diff --git a/tests/tools/test_async_delegation.py b/tests/tools/test_async_delegation.py
index 2c9c5c51290..3f42ed04300 100644
--- a/tests/tools/test_async_delegation.py
+++ b/tests/tools/test_async_delegation.py
@@ -1187,7 +1187,7 @@ print(json.dumps(q.get_nowait(), sort_keys=True))
assert "done: single background subagent" in format_process_notification(evt)
[email protected](sys.platform.startswith("win"), reason="POSIX mode bits not enforced on Windows")
[email protected]("posix") # POSIX mode bits not enforced on Windows
def test_connect_creates_state_db_0o600_under_permissive_umask(tmp_path, monkeypatch):
"""``_connect`` shares state.db with hermes_state.SessionDB -- a fresh
HERMES_HOME must land the file (and its WAL sidecar, if created) at 0o600
diff --git a/tests/tools/test_bot_live_owner_delivery.py b/tests/tools/test_bot_live_owner_delivery.py
index 367f51d66b4..5a726604832 100644
--- a/tests/tools/test_bot_live_owner_delivery.py
+++ b/tests/tools/test_bot_live_owner_delivery.py
@@ -170,8 +170,8 @@ def test_delivery_keeps_the_sender_and_refuses_a_different_one_under_the_same_id
assert "author" not in mailbox.deliver_to_live_owner(tmp_path, owner, "no sender", delivery_id="c" * 32)
[email protected](os.name == "nt" or getattr(os, "geteuid", lambda: 1)() == 0,
- reason="needs POSIX file permissions for an unreadable ticket")
[email protected](getattr(os, "geteuid", lambda: 1)() == 0, reason='needs POSIX file permissions for an unreadable ticket')
def test_unreadable_ticket_does_not_wedge_bulk_scans(tmp_path, caplog):
import logging
@@ -203,8 +203,8 @@ def test_unreadable_ticket_does_not_wedge_bulk_scans(tmp_path, caplog):
assert len(denied) == 1, "one persistent bad ticket must warn once per process, not per scan"
[email protected](os.name == "nt" or getattr(os, "geteuid", lambda: 1)() == 0,
- reason="needs POSIX file permissions for an unreadable ticket")
[email protected](getattr(os, "geteuid", lambda: 1)() == 0, reason='needs POSIX file permissions for an unreadable ticket')
def test_unreadable_ticket_keeps_exact_id_reads_fail_closed(tmp_path):
from tools import bot_live_delivery as mailbox
diff --git a/tests/tools/test_browser_use_cli.py b/tests/tools/test_browser_use_cli.py
index 119dba28a36..73cbc9b5731 100644
--- a/tests/tools/test_browser_use_cli.py
+++ b/tests/tools/test_browser_use_cli.py
@@ -159,7 +159,7 @@ class TestSubprocessEnvironment:
assert "PYTHONHOME" not in env
assert env["KEEP_ME"] == "yes"
- @pytest.mark.skipif(os.name == "nt", reason="POSIX PATH-floor semantics")
+ @pytest.mark.platforms("posix") # POSIX PATH-floor semantics
def test_subprocess_env_floors_version_manager_only_path(self, monkeypatch):
"""Profile workers (kanban bots, cron) can inherit a PATH of only
version-manager dirs (observed in the wild: one nvm dir repeated
@@ -183,7 +183,7 @@ class TestSubprocessEnvironment:
assert "/usr/bin" in parts
assert "/bin" in parts
- @pytest.mark.skipif(os.name == "nt", reason="POSIX PATH-floor semantics")
+ @pytest.mark.platforms("posix") # POSIX PATH-floor semantics
def test_floor_preserves_existing_entries_and_order(self):
"""The floor only adds dirs — never drops or reorders what the
caller's environment already had."""
@@ -194,7 +194,7 @@ class TestSubprocessEnvironment:
positions = [merged.index(p) for p in original.split(os.pathsep)]
assert positions == sorted(positions)
- @pytest.mark.skipif(os.name == "nt", reason="POSIX PATH-floor semantics")
+ @pytest.mark.platforms("posix") # POSIX PATH-floor semantics
def test_floor_survives_missing_sibling_helper(self, monkeypatch):
"""If browser_tool stops exporting _merge_browser_path, the floor
degrades to appending FHS bin dirs instead of vanishing."""
@@ -1324,7 +1324,7 @@ class TestTimeoutProcessGroupKill:
blocked forever, and the wedged call's activity heartbeat pins the session at
"now" in the sidebar indefinitely."""
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX process groups")
+ @pytest.mark.platforms("posix") # POSIX process groups
def test_timeout_kills_grandchild_and_returns_promptly(self, tmp_path, monkeypatch):
"""A grandchild that outlives the direct child and holds the inherited stdout
pipe must not keep browser_exec blocked past the timeout (it wedged permanently
diff --git a/tests/tools/test_computer_use_cua_macos_identity.py b/tests/tools/test_computer_use_cua_macos_identity.py
index 5aeb68201ba..b300da75114 100644
--- a/tests/tools/test_computer_use_cua_macos_identity.py
+++ b/tests/tools/test_computer_use_cua_macos_identity.py
@@ -33,7 +33,7 @@ def _patch_codesign(monkeypatch, proc):
monkeypatch.setattr(cua_backend.subprocess, "run", lambda *args, **kwargs: proc)
[email protected](os.name == "nt", reason="macOS bundle paths use POSIX separators")
[email protected]("posix") # macOS bundle paths use POSIX separators
def test_resolve_app_path_follows_real_symlink_and_is_idempotent(tmp_path):
app = tmp_path / "CuaDriver.app"
executable = app / "Contents" / "MacOS" / "cua-driver"
diff --git a/tests/tools/test_file_ops_single_roundtrip.py b/tests/tools/test_file_ops_single_roundtrip.py
index dc6400c913b..2dd8ffc1ee4 100644
--- a/tests/tools/test_file_ops_single_roundtrip.py
+++ b/tests/tools/test_file_ops_single_roundtrip.py
@@ -18,7 +18,7 @@ import pytest
from tools.environments.local import LocalEnvironment
from tools.file_operations import ExecuteResult, ShellFileOperations
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="POSIX shell probes")
+pytestmark = pytest.mark.platforms("posix") # POSIX shell probes
READ_PROBE_MARK = "__HERMES_RF_"
@@ -193,7 +193,6 @@ class TestReadFileNonTextPaths:
assert len(calls) == 1 and READ_PROBE_MARK not in calls[0]
assert r.is_image is True and r.file_size == 6
- @pytest.mark.platforms("linux")
def test_fifo_returns_not_regular_without_blocking(self, shell, tmp_path):
if not hasattr(os, "mkfifo"):
pytest.skip("no mkfifo")
@@ -324,7 +323,6 @@ class TestNativeRead:
for c in calls:
assert c == "echo $HOME" or c.startswith("ls -1 '~; echo PWNED"), c
- @pytest.mark.platforms("linux")
def test_fifo_refused_without_a_shell_and_without_blocking(self, native, tmp_path):
if not hasattr(os, "mkfifo"):
pytest.skip("no mkfifo")
diff --git a/tests/tools/test_kill_verify_tree_death.py b/tests/tools/test_kill_verify_tree_death.py
index 0acb6c35037..22729852cd7 100644
--- a/tests/tools/test_kill_verify_tree_death.py
+++ b/tests/tools/test_kill_verify_tree_death.py
@@ -104,7 +104,7 @@ def test_kill_with_dead_tree_still_reports_killed():
assert s.id in reg._finished
[email protected](sys.platform == "win32", reason="POSIX signal escalation; Windows uses taskkill")
[email protected]("posix") # POSIX signal escalation; Windows uses taskkill
def test_escalated_kill_of_sigterm_ignoring_child_reports_killed(tmp_path, monkeypatch):
"""The #115490 scenario itself: a child that ignores SIGTERM is SIGKILLed after the grace
window, and the verification must give the kernel a moment to reap it — poll() right
diff --git a/tests/tools/test_local_cwd_permission_fallback.py b/tests/tools/test_local_cwd_permission_fallback.py
index 35cec0175c2..2d0314352a5 100644
--- a/tests/tools/test_local_cwd_permission_fallback.py
+++ b/tests/tools/test_local_cwd_permission_fallback.py
@@ -27,13 +27,13 @@ def denied_dir(tmp_path):
d.chmod(0o755) # so pytest can clean up
-needs_posix_perms = pytest.mark.skipif(
- sys.platform == "win32" or os.geteuid() == 0,
- reason="chmod-based access denial needs POSIX + non-root",
+needs_non_root = pytest.mark.skipif(
+ getattr(os, "geteuid", lambda: 1)() == 0, reason="chmod-based access denial needs non-root"
)
-@needs_posix_perms
[email protected]("posix") # chmod-based access denial needs POSIX
+@needs_non_root
class TestInaccessibleCwdFallback:
def test_cwd_usable_rejects_unenterable_directory(self, denied_dir):
assert os.path.isdir(denied_dir) # the trap: stat succeeds
diff --git a/tests/tools/test_mcp_death_supervisor.py b/tests/tools/test_mcp_death_supervisor.py
index 427f8d125e7..ef8d507a532 100644
--- a/tests/tools/test_mcp_death_supervisor.py
+++ b/tests/tools/test_mcp_death_supervisor.py
@@ -22,9 +22,7 @@ import pytest
from tools import mcp_death_supervisor, mcp_tool
from tools import mcp_tool_lifecycle as _mcp_lifecycle
-pytestmark = pytest.mark.skipif(
- os.name != "posix", reason="the supervisor is POSIX-only (process groups)"
-)
+pytestmark = pytest.mark.platforms("posix") # the supervisor is POSIX-only (process groups)
SUPERVISOR = os.path.join(os.path.dirname(mcp_tool.__file__), "mcp_death_supervisor.py")
diff --git a/tests/tools/test_mcp_oauth.py b/tests/tools/test_mcp_oauth.py
index 38a321b32b1..dca8496712d 100644
--- a/tests/tools/test_mcp_oauth.py
+++ b/tests/tools/test_mcp_oauth.py
@@ -100,7 +100,7 @@ class TestHermesTokenStorage:
data = json.loads(token_path.read_text())
assert data["access_token"] == "abc123"
- @pytest.mark.skipif(sys.platform.startswith("win"), reason="POSIX mode bits not enforced on Windows")
+ @pytest.mark.platforms("posix") # POSIX mode bits not enforced on Windows
def test_token_file_created_with_0o600(self, tmp_path, monkeypatch):
"""Tokens must land on disk at 0o600 with no umask-default exposure window.
diff --git a/tests/tools/test_oneshot_completion_linger.py b/tests/tools/test_oneshot_completion_linger.py
index b2531051968..76a782314f6 100644
--- a/tests/tools/test_oneshot_completion_linger.py
+++ b/tests/tools/test_oneshot_completion_linger.py
@@ -375,7 +375,7 @@ def _run_e2e_parent(tmp_path, *, linger: bool) -> Path:
return marker
[email protected](sys.platform == "win32", reason="POSIX pipe/session semantics")
[email protected]("posix") # POSIX pipe/session semantics
def test_e2e_lingering_parent_keeps_background_delivery_alive(tmp_path):
"""Real processes: parent lingers → the backgrounded delivery survives
the parent's exit window and completes (marker file written)."""
@@ -390,7 +390,7 @@ def test_e2e_lingering_parent_keeps_background_delivery_alive(tmp_path):
)
[email protected](sys.platform == "win32", reason="POSIX pipe/session semantics")
[email protected]("posix") # POSIX pipe/session semantics
def test_e2e_control_immediate_exit_loses_delivery_without_linger(tmp_path):
"""Control proving the bug class: the same parent WITHOUT the linger may
lose the delivery. We assert only the fixed path's contract here — the
diff --git a/tests/tools/test_process_registry.py b/tests/tools/test_process_registry.py
index 4948673fdbf..996aa07ec9a 100644
--- a/tests/tools/test_process_registry.py
+++ b/tests/tools/test_process_registry.py
@@ -486,7 +486,7 @@ def test_pty_reader_loop_reassembles_multibyte_char_split_across_chunks(registry
# Orphaned-pipe reconciliation (issue #17327)
# =========================================================================
[email protected](sys.platform == "win32", reason="POSIX-only: uses setsid/fcntl")
[email protected]("posix") # POSIX-only: uses setsid/fcntl
class TestOrphanedPipeReconciliation:
"""Regression tests for issue #17327.
@@ -1733,7 +1733,7 @@ class TestTerminateHostPidPosix:
"Parent must receive SIGTERM before any snapshot descendant"
)
- @pytest.mark.skipif(sys.platform == "win32", reason="POSIX signal ordering; Windows uses taskkill")
+ @pytest.mark.platforms("posix") # POSIX signal ordering; Windows uses taskkill
@pytest.mark.live_system_guard_bypass
def test_posix_self_reaping_supervisor_child_is_never_signalled_by_registry(self, monkeypatch, tmp_path):
"""A parent that tears down its own children on SIGTERM keeps that job.
@@ -1836,8 +1836,7 @@ class TestPidReuseGuard:
assert s.id in registry._finished
[email protected](sys.platform == "win32",
- reason="POSIX SIGTERM→SIGKILL escalation; Windows uses taskkill /F")
[email protected]("posix") # POSIX SIGTERM→SIGKILL escalation; Windows uses taskkill /F
class TestSigkillEscalation:
"""Bounded SIGTERM→SIGKILL escalation in _terminate_host_pid.
@@ -2055,7 +2054,7 @@ class TestHandleProcessRedaction:
# Reader loop: orphaned grandchild holding the stdout pipe (issue #68915)
# =========================================================================
[email protected](sys.platform == "win32", reason="POSIX-only: select() on pipes")
[email protected]("posix") # POSIX-only: select() on pipes
class TestReaderLoopOrphanedPipe:
"""Regression tests for issue #68915.
@@ -2156,7 +2155,6 @@ class TestReaderLoopOrphanedPipe:
# =========================================================================
# systemd cgroup isolation for gateway-spawned local executors (#70716)
# =========================================================================
[email protected](sys.platform == "win32", reason="POSIX-only: systemd scopes")
class TestSystemdCgroupIsolation:
"""Verify spawn_local wraps the worker in ``systemd-run --user --scope``
when running under a supervisor and systemd-run is available, and falls
@@ -2263,6 +2261,7 @@ class TestSystemdCgroupIsolation:
# The session must record the unit name so kill_process can stop it.
assert session.systemd_unit == f"hermes-worker-{session.id}.scope"
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_falls_back_when_systemd_run_unavailable(self, registry, monkeypatch, _gateway_identity):
"""Under a supervisor but without systemd-run, fall back to the
legacy ``start_new_session=True`` path (worker shares the gateway
@@ -2291,6 +2290,7 @@ class TestSystemdCgroupIsolation:
assert argv == ["/bin/bash", "-lic", "set +m; echo hello"], argv
assert captured["start_new_session"] is True
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_falls_back_when_not_under_supervisor(self, registry, monkeypatch):
"""CLI mode (no supervisor) must NOT wrap in a systemd scope even if
systemd-run is available — isolation is a gateway concern."""
@@ -2318,6 +2318,7 @@ class TestSystemdCgroupIsolation:
assert captured["start_new_session"] is True
@pytest.mark.parametrize("use_pty", [False, True])
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_inherited_systemd_marker_does_not_scope_interactive_cli(
self, registry, monkeypatch, use_pty
):
@@ -2364,6 +2365,7 @@ class TestSystemdCgroupIsolation:
assert session.systemd_unit == ""
@pytest.mark.parametrize("use_pty", [False, True])
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_inherited_gateway_tree_markers_do_not_scope_child_cli(
self, registry, monkeypatch, use_pty
):
@@ -2568,6 +2570,7 @@ class TestSystemdCgroupIsolation:
stop_unit.assert_called_once()
pipe_spawn.assert_not_called()
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_worker_memory_limit_honors_local_guard_mb_override(self, monkeypatch):
import tools.process_registry as pr
@@ -2583,6 +2586,7 @@ class TestSystemdCgroupIsolation:
warning.assert_not_called()
assert f"MemoryMax={123 * 1024 * 1024}" in argv
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_worker_memory_limit_caps_oversized_local_guard_override(
self, monkeypatch
):
@@ -2602,6 +2606,7 @@ class TestSystemdCgroupIsolation:
assert pr._worker_memory_max_bytes() == pr._DEFAULT_WORKER_MEMORY_MAX_BYTES
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_kill_recovered_detached_already_exited_stops_persisted_scope(
self, registry, monkeypatch
):
@@ -2663,6 +2668,7 @@ class TestSystemdCgroupIsolation:
value.startswith("OOMPolicy=") for value in probe_argv if isinstance(value, str)
), probe_argv
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_successful_systemd_probe_revalidates_after_cache_ttl(self, monkeypatch):
"""A vanished user bus invalidates a formerly successful scope verdict."""
import tools.process_registry as pr
@@ -2876,6 +2882,7 @@ class TestSystemdCgroupIsolation:
assert pr._systemd_run_user_scope_available() is True
assert len(probe_calls) == 2
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_stop_systemd_unit_treats_absent_unit_as_clean(self, monkeypatch):
import tools.process_registry as pr
@@ -2891,6 +2898,7 @@ class TestSystemdCgroupIsolation:
assert pr._stop_systemd_unit("hermes-worker-gone.scope") is True
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_darwin_never_takes_scope_path_even_with_systemd_run_on_path(
self, registry, monkeypatch, _gateway_identity
):
@@ -2944,6 +2952,7 @@ class TestSystemdCgroupIsolation:
assert scope_builds == [], "darwin must never build a systemd scope argv"
assert probe_runs == [], "darwin must never run the systemd-run probe"
+ @pytest.mark.platforms("posix") # POSIX-only: systemd scopes
def test_probe_returns_false_off_linux(self, monkeypatch):
"""``_systemd_run_user_scope_available`` is False on non-Linux even
when a ``systemd-run`` binary exists on PATH."""
diff --git a/tests/tools/test_process_registry_windows_live.py b/tests/tools/test_process_registry_windows_live.py
index a10c2f23706..aad1cf637c4 100644
--- a/tests/tools/test_process_registry_windows_live.py
+++ b/tests/tools/test_process_registry_windows_live.py
@@ -19,9 +19,7 @@ import time
import pytest
-pytestmark = pytest.mark.skipif(
- sys.platform != "win32", reason="live Windows background-executor E2E"
-)
+pytestmark = pytest.mark.platforms("windows") # live Windows background-executor E2E
@pytest.fixture()
diff --git a/tests/tools/test_pty_query_responder.py b/tests/tools/test_pty_query_responder.py
index 3c237188a99..34414e0d15f 100644
--- a/tests/tools/test_pty_query_responder.py
+++ b/tests/tools/test_pty_query_responder.py
@@ -120,7 +120,7 @@ def test_dec_mode_non_digit_passes_through():
assert out + r.flush() == seq
[email protected](sys.platform == "win32", reason="POSIX ptyprocess only")
[email protected]("posix") # POSIX ptyprocess only
def test_live_pty_subprocess_unblocked_by_cursor_report(tmp_path):
"""E2E: a PTY subprocess blocking on ESC[6n exits once answered.
diff --git a/tests/tools/test_search_native_rg.py b/tests/tools/test_search_native_rg.py
index 2ba2b36ceac..6bf8581afbf 100644
--- a/tests/tools/test_search_native_rg.py
+++ b/tests/tools/test_search_native_rg.py
@@ -14,7 +14,7 @@ import pytest
from tools.environments.local import LocalEnvironment
from tools.file_operations import ShellFileOperations
-pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="native rg lane is POSIX-only")
+pytestmark = pytest.mark.platforms("posix") # native rg lane is POSIX-only
@pytest.fixture
diff --git a/tests/tools/test_skill_improvements.py b/tests/tools/test_skill_improvements.py
index 38b4f8455d2..dc4481130cd 100644
--- a/tests/tools/test_skill_improvements.py
+++ b/tests/tools/test_skill_improvements.py
@@ -102,7 +102,7 @@ word word word
# Should succeed via line-trimmed or indentation-flexible matching
assert result["success"] is True
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_created_skill_is_group_readable(self):
"""New instructional skills use the public-document mode 0644."""
_create_skill("mode-skill", SKILL_CONTENT)
@@ -121,7 +121,7 @@ word word word
assert result["success"] is False
assert not (self.skills_dir / "blocked-skill").exists()
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_new_documents_are_exactly_0644_under_restrictive_umask(self):
"""New skill documents override a restrictive process umask."""
old_umask = os.umask(0o077)
@@ -140,7 +140,7 @@ word word word
assert stat.S_IMODE(skill_md.stat().st_mode) == 0o644
assert stat.S_IMODE(reference.stat().st_mode) == 0o644
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_explicit_skill_md_patch_preserves_existing_mode(self):
"""Explicit SKILL.md patch paths preserve the existing document mode."""
_create_skill("explicit-skill", SKILL_CONTENT)
@@ -158,7 +158,7 @@ word word word
assert "Step 1: Done!" in skill_md.read_text(encoding="utf-8")
assert stat.S_IMODE(skill_md.stat().st_mode) == 0o660
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
@pytest.mark.parametrize("mode", [0o600, 0o660])
def test_edit_preserves_existing_mode(self, mode):
"""Full skill edits must preserve private and shared document modes."""
@@ -172,7 +172,7 @@ word word word
assert result["success"] is True
assert stat.S_IMODE(skill_md.stat().st_mode) == mode
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
@pytest.mark.parametrize("mode", [0o600, 0o660])
def test_patched_skill_preserves_existing_mode(self, mode):
"""Atomic patching must preserve both private and shared modes."""
@@ -185,7 +185,7 @@ word word word
assert result["success"] is True
assert stat.S_IMODE(skill_md.stat().st_mode) == mode
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_supporting_file_write_uses_group_readable_mode(self):
"""New reference files should follow the same document mode."""
_create_skill("mode-skill", SKILL_CONTENT)
@@ -200,7 +200,7 @@ word word word
reference = self.skills_dir / "mode-skill" / "references/example.md"
assert stat.S_IMODE(reference.stat().st_mode) == 0o644
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
@pytest.mark.parametrize("mode", [0o600, 0o660])
def test_supporting_file_write_preserves_existing_mode(self, mode):
"""Overwriting a reference preserves its existing private or shared mode."""
@@ -215,7 +215,7 @@ word word word
assert result["success"] is True
assert stat.S_IMODE(reference.stat().st_mode) == mode
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
@pytest.mark.parametrize("mode", [0o600, 0o660])
def test_supporting_file_patch_preserves_existing_mode(self, mode):
"""Patching a reference preserves its existing private or shared mode."""
@@ -236,7 +236,7 @@ word word word
assert reference.read_text(encoding="utf-8") == "new\n"
assert stat.S_IMODE(reference.stat().st_mode) == mode
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_supporting_file_patch_rollback_preserves_mode_when_scan_blocks(
self, monkeypatch
):
@@ -262,7 +262,7 @@ word word word
assert reference.read_text(encoding="utf-8") == "original\n"
assert stat.S_IMODE(reference.stat().st_mode) == 0o660
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_edit_rollback_preserves_existing_mode_when_scan_blocks(self, monkeypatch):
"""Blocked full edits restore both content and the original mode."""
_create_skill("rollback-skill", SKILL_CONTENT)
@@ -280,7 +280,7 @@ word word word
assert skill_md.read_text(encoding="utf-8") == SKILL_CONTENT
assert stat.S_IMODE(skill_md.stat().st_mode) == 0o660
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_patch_rollback_preserves_existing_mode_when_scan_blocks(self, monkeypatch):
"""Blocked patches restore both content and the original mode."""
_create_skill("rollback-skill", SKILL_CONTENT)
@@ -299,7 +299,7 @@ word word word
assert skill_md.read_text(encoding="utf-8") == SKILL_CONTENT
assert stat.S_IMODE(skill_md.stat().st_mode) == 0o600
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits")
+ @pytest.mark.platforms("posix") # POSIX permission bits
def test_supporting_file_rollback_preserves_existing_mode_when_scan_blocks(
self, monkeypatch
):
diff --git a/tests/tools/test_skills_sync.py b/tests/tools/test_skills_sync.py
index 842068e1ea3..c0026964b12 100644
--- a/tests/tools/test_skills_sync.py
+++ b/tests/tools/test_skills_sync.py
@@ -51,7 +51,7 @@ class TestReadWriteManifest:
assert result == {"old-skill": "", "new-skill": "abc123"}
- @pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits are platform-specific")
+ @pytest.mark.platforms("posix") # POSIX permission bits are platform-specific
def test_write_manifest_preserves_existing_file_mode(self, tmp_path):
manifest_file = tmp_path / ".bundled_manifest"
manifest_file.write_text("old-skill:oldhash\n", encoding="utf-8")
diff --git a/tests/tools/test_snapshot_multiline_session_env_injection.py b/tests/tools/test_snapshot_multiline_session_env_injection.py
index 8a3e6414850..ba875dfd836 100644
--- a/tests/tools/test_snapshot_multiline_session_env_injection.py
+++ b/tests/tools/test_snapshot_multiline_session_env_injection.py
@@ -65,7 +65,7 @@ fi
)
[email protected](sys.platform == "win32", reason="POSIX bash snapshot path")
[email protected]("posix") # POSIX bash snapshot path
def test_multiline_session_chat_name_not_executed_via_snapshot(tmp_path: Path):
"""Continuation lines of HERMES_SESSION_CHAT_NAME must not run on source."""
marker = tmp_path / "pwned"
@@ -82,7 +82,7 @@ def test_multiline_session_chat_name_not_executed_via_snapshot(tmp_path: Path):
assert not marker.exists()
[email protected](sys.platform == "win32", reason="POSIX bash snapshot path")
[email protected]("posix") # POSIX bash snapshot path
def test_multiline_session_user_name_not_executed_via_snapshot(tmp_path: Path):
"""Same hole via HERMES_SESSION_USER_NAME (display-name path)."""
marker = tmp_path / "pwned_user"
diff --git a/tests/tools/test_snapshot_session_id_leak.py b/tests/tools/test_snapshot_session_id_leak.py
index 7c94ca9466a..f22a8b3a761 100644
--- a/tests/tools/test_snapshot_session_id_leak.py
+++ b/tests/tools/test_snapshot_session_id_leak.py
@@ -73,7 +73,7 @@ def test_export_snippet_shape():
# Integration: real LocalEnvironment, two sessions, no cross-contamination.
# ---------------------------------------------------------------------------
[email protected](sys.platform == "win32", reason="POSIX bash snapshot path")
[email protected]("posix") # POSIX bash snapshot path
def test_shared_snapshot_no_cross_session_leak(tmp_path):
import threading
@@ -119,7 +119,7 @@ def test_shared_snapshot_no_cross_session_leak(tmp_path):
# persist into the snapshot either.
# ---------------------------------------------------------------------------
[email protected](sys.platform == "win32", reason="POSIX bash snapshot path")
[email protected]("posix") # POSIX bash snapshot path
def test_export_dump_drops_every_bridged_var_and_the_delegation_marker():
"""Run the real dump: nothing the gateway bridges per command, nor the
delegate_task marker, may survive ``export -p``; ordinary exports must."""
@@ -137,7 +137,7 @@ def test_export_dump_drops_every_bridged_var_and_the_delegation_marker():
assert 'declare -x MYVAR="keep"' in out
[email protected](sys.platform == "win32", reason="POSIX bash snapshot path")
[email protected]("posix") # POSIX bash snapshot path
def test_snapshot_does_not_turn_later_commands_into_delegated_children(tmp_path):
"""A snapshot re-dumped during a delegated child's command must not re-export
the marker into the parent's next ``source`` (#90782)."""
diff --git a/tests/tools/test_spill_safety.py b/tests/tools/test_spill_safety.py
index 561d3d226d6..54057293c2f 100644
--- a/tests/tools/test_spill_safety.py
+++ b/tests/tools/test_spill_safety.py
@@ -19,7 +19,7 @@ from tools.spill_safety import (
write_text_exclusive,
)
-posix_only = pytest.mark.skipif(sys.platform == "win32", reason="POSIX perms/symlinks")
+posix_only = pytest.mark.platforms("posix") # POSIX perms/symlinks
def test_write_creates_file_with_content(tmp_path):
diff --git a/tests/tools/test_tts_command_providers.py b/tests/tools/test_tts_command_providers.py
index 9e1e24c229b..a422bc41a8d 100644
--- a/tests/tools/test_tts_command_providers.py
+++ b/tests/tools/test_tts_command_providers.py
@@ -396,7 +396,7 @@ class TestGenerateCommandTts:
assert out.read_text(encoding="utf-8") == "hello world"
- @pytest.mark.skipif(os.name == "nt", reason="POSIX-only timeout semantics")
+ @pytest.mark.platforms("posix") # POSIX-only timeout semantics
def test_timeout_raises_runtime(self, tmp_path):
config = {
"command": f'"{sys.executable}" -c "import time; time.sleep(10)"',
diff --git a/tests/tools/test_tts_streaming.py b/tests/tools/test_tts_streaming.py
index a2bd3e3f020..690210deb9b 100644
--- a/tests/tools/test_tts_streaming.py
+++ b/tests/tools/test_tts_streaming.py
@@ -310,10 +310,7 @@ def test_stream_cap_truncates_runaway_upstream(monkeypatch):
# platform.system() == "Linux" (a no-op on the Linux CI lane) purely to
# shield macOS dev machines; an honest exclusion skipif says the same
# thing without lying to the interpreter.
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_streamer_path_handles_misaligned_pcm_chunks(monkeypatch):
"""Regression: PCM chunks with odd byte counts must not be dropped.
@@ -365,10 +362,7 @@ def test_streamer_path_handles_misaligned_pcm_chunks(monkeypatch):
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_streamer_path_survives_portaudio_write_error(monkeypatch):
"""Regression: a transient PortAudio error on output_stream.write must
not kill the playback thread or hang the pipeline join.
@@ -405,10 +399,7 @@ def test_streamer_path_survives_portaudio_write_error(monkeypatch):
assert done.is_set(), "done event must fire even after PortAudio error"
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_streamer_reinit_after_portaudio_error_plays_remaining_sentences(monkeypatch):
"""Regression: after a PortAudio error the worker must reinit the stream
and continue playing remaining sentences instead of dropping them.
@@ -465,10 +456,7 @@ def test_streamer_reinit_after_portaudio_error_plays_remaining_sentences(monkeyp
assert done.is_set(), "done event must fire after recovery"
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_streamer_tempfile_fallback_after_reinit_exhausted(monkeypatch):
"""Regression: after 3 failed reinits, remaining sentences must play
via the temp-file fallback, not be silently dropped.
@@ -531,10 +519,7 @@ def test_streamer_tempfile_fallback_after_reinit_exhausted(monkeypatch):
# ── Dispatch: hybrid batch-prefetch path ──────────────────────────────────
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_first_sentence_streamed_individually(monkeypatch):
"""The first sentence must get its own stream() call for low TTFA."""
from tools import tts_tool
@@ -568,10 +553,7 @@ def test_hybrid_first_sentence_streamed_individually(monkeypatch):
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_speaker_honours_tts_streaming_min_len_for_short_cjk_opener(monkeypatch):
"""The CLI/TUI speaker cuts with the profile's tts.streaming.min_len (#96927): a 7-char CJK
opener is streamed on its own instead of riding behind the second sentence."""
@@ -605,10 +587,7 @@ def test_speaker_honours_tts_streaming_min_len_for_short_cjk_opener(monkeypatch)
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_subsequent_sentences_prefetched_individually(monkeypatch):
"""Every sentence should get its own stream() call — per-sentence
prefetch fires the HTTP request the moment each sentence completes,
@@ -658,10 +637,7 @@ def test_hybrid_subsequent_sentences_prefetched_individually(monkeypatch):
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_short_sentences_each_get_own_call(monkeypatch):
"""Short sentences should each get their own stream() call — no batching,
no waiting for a threshold or end-of-text."""
@@ -703,10 +679,7 @@ def test_hybrid_short_sentences_each_get_own_call(monkeypatch):
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_done_event_waits_for_prefetch(monkeypatch):
"""The done event must not fire until the prefetch thread has finished,
otherwise continuous voice mode could overlap turns."""
@@ -755,10 +728,7 @@ def test_hybrid_done_event_waits_for_prefetch(monkeypatch):
)
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_single_sentence_still_works(monkeypatch):
"""A single-sentence reply should stream immediately with no batch."""
from tools import tts_tool
@@ -792,10 +762,7 @@ def test_hybrid_single_sentence_still_works(monkeypatch):
assert done.is_set()
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_hybrid_playback_serialized_no_overlap(monkeypatch):
"""Multiple batch flushes must not overlap on the output stream.
@@ -889,10 +856,7 @@ def test_hybrid_prefetch_fires_http_immediately(monkeypatch):
assert first_saw_prefetch == [True], "prefetch waited for first-sentence playback"
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_display_callback_not_called_when_streaming_enabled(monkeypatch):
"""When streaming is enabled, display_callback must NOT be passed to
the TTS consumer — the token stream already renders text. This
@@ -1130,10 +1094,7 @@ def test_openai_pcm_sample_rate_resolution(config, headers, expected):
assert ts.OpenAIStreamer({}, {"api_key": "sk-x", **config}).sample_rate == expected
- sys.platform == "darwin",
- reason="macOS deliberately skips the sounddevice OutputStream path (PR #62601)",
-)
[email protected]("not macos") # macOS deliberately skips the sounddevice OutputStream path (PR #62601)
def test_speaker_output_stream_opens_at_rate_learned_from_first_chunk(monkeypatch):
"""Issue #76466: the PortAudio device is opened after the first chunk arrived, at the rate
the provider learned from the response, not at the construction-time default."""
diff --git a/tests/tui_gateway/test_entry_rpc_stdin_cloexec.py b/tests/tui_gateway/test_entry_rpc_stdin_cloexec.py
index 3549142d5f7..43454562cfd 100644
--- a/tests/tui_gateway/test_entry_rpc_stdin_cloexec.py
+++ b/tests/tui_gateway/test_entry_rpc_stdin_cloexec.py
@@ -8,7 +8,7 @@ import pytest
from tui_gateway import entry
[email protected](os.name != "posix", reason="POSIX close-on-exec semantics")
[email protected]("posix") # POSIX close-on-exec semantics
def test_rpc_stdin_is_closed_before_a_bare_child_executes(monkeypatch):
"""A child with no explicit stdin must not be able to consume RPC bytes."""
original_stdin = os.dup(0)