Skip to content

The agent that grows with you

refactor(tests): platforms() fully replaces the linux_only/macos_only/windows_only trio

ethernet9b8ad35ee630
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index bd2cd01ea8b..59d4abf0796 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -197,7 +197,7 @@ jobs:
status=0
uv run --no-sync python -m pytest \
"$@" \
- -m "${{ matrix.marker }} and not integration" \
+ -m "platforms and not integration" \
-v --tb=short || status=$?
if [ "$status" -eq 5 ]; then
echo "::error::No tests matched -m ${{ matrix.marker }}. Either the" \
diff --git a/AGENTS.md b/AGENTS.md
index f92c4c36235..bfb49c8ac49 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1646,8 +1646,8 @@ plus optional arch filters, so it can express more than the legacy trio:
```
Specs: `linux`, `macos`, `windows`, `posix`, `any`, and `not <spec>`.
-The legacy `linux_only` / `macos_only` / `windows_only` markers remain
-accepted as aliases; prefer `platforms` in new tests.
+The historic `linux_only` / `macos_only` / `windows_only` markers have been
+fully replaced — `platforms` is the only host-gating marker in the tree.
Things that are host-independent can stay unmarked:
@@ -1680,16 +1680,15 @@ argv, not the direct parent (the venv shim makes every spawn a
launcher/worker chain).
**Use the marker, never a bare `skipif`.** `scripts/ci/list_os_marked_tests.py`
-decides which files the macOS/Windows lanes import by grepping for the marker
-*name*, and the lane then filters with `-m <marker>`. A test gated with
-`@pytest.mark.skipif(sys.platform != "win32")` therefore skips on Linux AND is
-never imported on the Windows lane — it runs on no host at all, silently. The
-same trap catches a file-local alias (`windows_only = pytest.mark.skipif(...)`):
-the grep matches the name, so the file *is* listed, but `-m windows_only`
-deselects every test in it and the lane reports green over zero coverage. And
-don't stack a module-level `platforms`/`_only` gate on a file whose tests
-carry their own host marker — the conftest hard-rejects tests carrying two
-host-OS markers (a test skipped on every host, reported green everywhere).
+decides which files the macOS lane imports by grepping for the quoted spec
+inside `platforms(...)`, and the lane then selects with `-m platforms` while
+the conftest's per-test host skips do the actual gating. A test gated with
+`@pytest.mark.skipif(sys.platform != "win32")` therefore runs on no host at
+all, silently — it is never imported by the lane that would run it, and the
+full-suite lanes skip it. Don't stack a module-level `pytestmark =
+platforms(...)` on a file whose tests carry their own host marker — the
+conftest hard-rejects tests carrying two `platforms()` markers (a test
+skipped on every host, reported green everywhere).
Equally, don't `pytest.skip()` the non-host rows of a `@parametrize` over
platforms — split it into one marked test per OS, or only the host's row ever
executes.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fc5c22c2cbe..735378b9da0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -836,9 +836,9 @@ that touches the OS, assume *any* platform can hit your code path.
Tests that excercise behavior on specific platforms must run on their target platforms.
```python
```
Avoid monkeypatching `sys.platform` unless absolutely needed, but if you do, also patch `platform.system()` / `platform.release()` / `platform.mac_ver()`.
Symlinks, 0o600 permissions, SIGALRM, os.setsid/fork are all unix-only.
diff --git a/pyproject.toml b/pyproject.toml
index eff5d0d0310..e27b4e0cf87 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -608,9 +608,7 @@ markers = [
"requires_wal: needs the runtime to actually enable SQLite WAL mode (skipped where Hermes falls back to journal_mode=DELETE)",
"no_isolate: opt out of per-file subprocess isolation (tests share mutable module-level state)",
"ssh: marks tests requiring a reachable SSH server (skipped in normal CI)",
- "linux_only: exercises Linux-specific behaviour; skipped on other hosts",
- "macos_only: exercises macOS-specific behaviour; skipped on other hosts",
- "windows_only: exercises native-Windows behaviour; skipped on other hosts",
+ "platforms(*specs, arch=None, arch_negate=False): run only on hosts matching at least one spec — linux/macos/windows/posix/any, 'not X' negation, optional arch filter",
]
# integration tests take way too long to run in the normal CI environments
addopts = "-m 'not integration'"
diff --git a/scripts/ci/list_os_marked_tests.py b/scripts/ci/list_os_marked_tests.py
index 5aac4989579..1e65c4d4e3d 100644
--- a/scripts/ci/list_os_marked_tests.py
+++ b/scripts/ci/list_os_marked_tests.py
@@ -1,39 +1,34 @@
#!/usr/bin/env python3
-"""List the test files that carry a given platform marker.
+"""List the test files that carry a platforms() gate for a given platform.
Used by the marked-OS lane of ``.github/workflows/tests.yml`` to scope what
the macOS lane imports.
-Why scope at all, when ``pytest -m macos_only`` already selects correctly?
+Why scope at all, when ``pytest -m platforms`` already selects correctly?
Because ``-m`` filters AFTER collection, and collection IMPORTS every test
module under ``tests/``. On the Linux lane that is fine (it runs them all
-anyway), but on the macOS/Windows lanes it would drag ~900 unrelated modules
-through import on a host they were never expected to import on — one
-unrelated ImportError would fail a job whose actual subject passed. Narrowing
-the paths keeps each lane's failure signal about its own tests.
-
-``-m`` is still passed by the workflow and remains the authoritative
-selector: this script only decides which files get imported, never which
-tests run. Over-selecting here is harmless (``-m`` drops the extras); the
-failure mode to care about is UNDER-selecting, which is why the workflow
-fails the job when zero tests end up selected.
-
-Markers accepted:
-
- * the composable ``platforms`` form (e.g. ``@pytest.mark.platforms("macos")``
- or ``pytest.mark.platforms("macos", ...)``). The script matches any
- ``platforms(...)`` usage that names the platform in question — including
- negated specs (``"not macos"`` lists the file for the macOS lane: the
- lane's ``-m`` filter then decides what actually runs). Whole-word
- matching, so a ``"macos"`` spec doesn't match a hypothetical
- ``"macos_beta"`` spec.
- * the legacy trio (``linux_only`` / ``macos_only`` / ``windows_only``),
- matched as whole words in both decorator and ``pytestmark`` forms.
+anyway), but on the macOS lane it would drag ~900 unrelated modules through
+import on a host they were never expected to import on — one unrelated
+ImportError would fail a job whose actual subject passed. Narrowing the
+paths keeps each lane's failure signal about its own tests.
+
+``-m platforms`` (plus the conftest's per-test host skips) remains the
+authoritative selector: this script only decides which files get imported,
+never which tests run. Over-selecting here is harmless (the skips drop the
+extras); the failure mode to care about is UNDER-selecting, which is why
+the workflow fails the job when zero tests end up selected.
+
+A file matches when a quoted ``platforms("...")`` spec names the platform —
+including negated (``"not macos"``) and any-of lists. The match is anchored
+inside the string literal so bare identifiers (a variable named ``windows``)
+don't produce false positives.
Usage:
python scripts/ci/list_os_marked_tests.py macos [tests_root]
-Prints one path per line (POSIX separators, repo-relative), sorted.
+Prints one path per line (POSIX separators, repo-relative), sorted. Exits
+non-zero when no file matches (a renamed spec or broken selection would
+otherwise report a green lane that ran nothing).
"""
from __future__ import annotations
@@ -42,25 +37,14 @@ import re
import sys
from pathlib import Path
-_VALID_MARKERS = ("linux", "macos", "windows", "linux_only", "macos_only", "windows_only")
+_VALID_PLATFORMS = ("linux", "macos", "windows")
-def find_marked_files(marker: str, root: Path) -> list[Path]:
- """Return every ``test_*.py`` under *root* that references *marker*.
-
- Catches the composable ``platforms("...")`` spec form, the legacy
- decorator form, and the module-level ``pytestmark`` form.
- """
- if marker in ("linux", "macos", "windows"):
- # Composable form: platforms("<marker>" ...) — quoted spec, so match
- # the quoted string to avoid bare-word false positives (a variable
- # named `windows`, etc.). Also keep the legacy whole-word form.
- pattern = re.compile(
- rf'platforms\(\s*[^)]*?"[^")]*\b{re.escape(marker)}\b[^")]*"|'
- rf"\b{re.escape(marker)}_only\b"
- )
- else:
- pattern = re.compile(rf"\b{re.escape(marker)}\b")
+def find_marked_files(platform: str, root: Path) -> list[Path]:
+ """Return every ``test_*.py`` under *root* gating on *platform*."""
+ pattern = re.compile(
+ rf'platforms\(\s*[^)]*?"[^")]*\b{re.escape(platform)}\b[^")]*"'
+ )
hits: list[Path] = []
for path in sorted(root.rglob("test_*.py")):
try:
@@ -76,10 +60,10 @@ def main(argv: list[str]) -> int:
if len(argv) < 2:
print(__doc__, file=sys.stderr)
return 2
- marker = argv[1]
- if marker not in _VALID_MARKERS:
+ platform = argv[1]
+ if platform not in _VALID_PLATFORMS:
print(
- f"unknown marker {marker!r}; valid: {', '.join(_VALID_MARKERS)}",
+ f"unknown platform {platform!r}; valid: {', '.join(_VALID_PLATFORMS)}",
file=sys.stderr,
)
return 2
@@ -87,16 +71,13 @@ def main(argv: list[str]) -> int:
if not tests_root.is_dir():
print(f"no such directory: {tests_root}", file=sys.stderr)
return 2
- hits = find_marked_files(marker, tests_root)
+ hits = find_marked_files(platform, tests_root)
for path in hits:
print(path.as_posix())
- # A marker that selects nothing is almost certainly renamed or dropped;
- # the CI lane fails loudly on an empty list rather than reporting a
- # green job that ran nothing.
if not hits:
print(
- f"no test files carry marker {marker!r} under {tests_root} — "
- "either the marker was renamed or dropped, or selection is broken",
+ f"no test files gate on {platform!r} under {tests_root} — "
+ "either the spec vocabulary changed or selection is broken",
file=sys.stderr,
)
return 1
diff --git a/tests/acp/test_ping_suppression.py b/tests/acp/test_ping_suppression.py
index d003ba1e73c..38a67aae790 100644
--- a/tests/acp/test_ping_suppression.py
+++ b/tests/acp/test_ping_suppression.py
@@ -99,7 +99,7 @@ class _FakeAgent:
pass
@pytest.mark.asyncio
async def test_bare_ping_request_produces_proper_response_and_no_stderr_noise(
caplog: pytest.LogCaptureFixture,
diff --git a/tests/agent/lsp/test_install_and_lint_fixes.py b/tests/agent/lsp/test_install_and_lint_fixes.py
index cbaa30e3887..314e9675045 100644
--- a/tests/agent/lsp/test_install_and_lint_fixes.py
+++ b/tests/agent/lsp/test_install_and_lint_fixes.py
@@ -61,11 +61,11 @@ def test_install_npm_works_without_extras(tmp_path, monkeypatch):
def test_install_pip_finds_windows_scripts_launcher(tmp_path, monkeypatch):
"""pip console scripts can land in Scripts/ on native Windows.
- ``windows_only``: the ``Scripts/`` layout and the ``.exe`` launcher are
+ ``platforms("windows")``: the ``Scripts/`` layout and the ``.exe`` launcher are
what pip actually produces on Windows. Faking ``_is_windows()`` on Linux
made the test assert against a directory tree the test itself created, on
a host where pip would never lay it out that way.
diff --git a/tests/agent/lsp/test_workspace.py b/tests/agent/lsp/test_workspace.py
index c7b22a5ddc9..9e075b9d006 100644
--- a/tests/agent/lsp/test_workspace.py
+++ b/tests/agent/lsp/test_workspace.py
@@ -69,7 +69,7 @@ def test_resolve_workspace_for_file_uses_cwd_first(tmp_path: Path, monkeypatch):
def test_normalize_path_expands_tilde(monkeypatch):
monkeypatch.setenv("HOME", "/home/user")
p = normalize_path("~/x.py")
diff --git a/tests/agent/test_anthropic_keychain.py b/tests/agent/test_anthropic_keychain.py
index 7f1174967c2..7673be47ffd 100644
--- a/tests/agent/test_anthropic_keychain.py
+++ b/tests/agent/test_anthropic_keychain.py
@@ -19,11 +19,11 @@ from agent.anthropic_adapter import (
pytestmark = pytest.mark.allow_macos_keychain
class TestReadClaudeCodeCredentialsFromKeychain:
"""Bug 4: macOS Keychain support for Claude Code >=2.1.114.
- ``macos_only``: the reader is gated on ``platform.system() == "Darwin"``
+ ``platforms("macos")``: the reader is gated on ``platform.system() == "Darwin"``
and shells out to the ``security`` CLI. Faking Darwin on Linux selected
the branch but proved nothing about the host it exists for; on the real
macOS runner only ``subprocess.run`` is mocked (via the
@@ -51,7 +51,7 @@ class TestReadClaudeCodeCredentialsFromKeychain:
class TestReadClaudeCodeCredentialsPriority:
"""Bug 4: Keychain must be checked before the JSON file."""
@@ -122,7 +122,7 @@ class TestReadClaudeCodeCredentialsPriority:
assert creds is None
class TestReadClaudeCodeCredentialsDesync:
"""Reconciliation when Keychain and JSON file disagree.
diff --git a/tests/agent/test_anthropic_oauth_stress.py b/tests/agent/test_anthropic_oauth_stress.py
index b558eb4a6aa..fc6b00d2eae 100644
--- a/tests/agent/test_anthropic_oauth_stress.py
+++ b/tests/agent/test_anthropic_oauth_stress.py
@@ -261,7 +261,7 @@ def test_high_concurrency_anthropic_refresh_no_lost_updates_no_deadlock(
@pytest.mark.live_system_guard_bypass
def test_distinct_profiles_share_one_claude_refresh_without_duplicate_post(
hermes_home,
):
diff --git a/tests/agent/test_command_token_source.py b/tests/agent/test_command_token_source.py
index e528005ebfa..803bece06c8 100644
--- a/tests/agent/test_command_token_source.py
+++ b/tests/agent/test_command_token_source.py
@@ -117,14 +117,14 @@ class TestNoCredentialLeak:
class TestCaching:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_token_is_cached_between_calls(self):
"""Without caching the command would run on every request."""
# A command whose output changes each run: equal results prove caching.
source = CommandTokenSource("date +%s%N", "dbx")
assert source() == source()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_expired_token_is_reminted(self):
# date +%s%N changes every run; $RANDOM would be bash-only (empty
# under dash, which is what /bin/sh is on Debian-family CI).
@@ -137,7 +137,7 @@ class TestCaching:
source._expires_at = 0.0
assert source() != first
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_no_advertised_ttl_caches_on_a_bounded_window(self):
"""No TTL means a bounded cache, not a process-lifetime one.
@@ -309,7 +309,7 @@ class TestAbsoluteExpiry:
)
assert ttl is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_the_token_actually_gets_re_minted(self, tmp_path):
"""The regression that mattered: a deadline must expire the cache."""
counter = tmp_path / "calls"
diff --git a/tests/agent/test_shell_hooks.py b/tests/agent/test_shell_hooks.py
index cc52130503b..e29b2423388 100644
--- a/tests/agent/test_shell_hooks.py
+++ b/tests/agent/test_shell_hooks.py
@@ -142,7 +142,7 @@ class TestMatcher:
# ── End-to-end subprocess behaviour ───────────────────────────────────────
class TestCallbackSubprocess:
@@ -679,7 +679,7 @@ class TestEvaluateResult:
class TestFailSemanticsEndToEnd:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_exit_2_script_blocks(self, tmp_path):
script = _write_script(
tmp_path, "exit2.sh",
@@ -707,7 +707,7 @@ class TestFailSemanticsEndToEnd:
assert result is not None and result["action"] == "block"
assert "failed closed" in result["message"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_run_once_reflects_exit_2_block(self, tmp_path):
"""hermes hooks test must mirror production semantics."""
script = _write_script(
@@ -725,7 +725,7 @@ class TestFailSemanticsEndToEnd:
assert result["returncode"] == 2
assert result["parsed"] == {"action": "block", "message": "denied"}
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_run_once_reflects_fail_closed_timeout(self, tmp_path):
script = _write_script(
tmp_path, "sleepy.sh",
diff --git a/tests/agent/test_shell_hooks_consent.py b/tests/agent/test_shell_hooks_consent.py
index 86cb565a3f3..0ac00d14f2e 100644
--- a/tests/agent/test_shell_hooks_consent.py
+++ b/tests/agent/test_shell_hooks_consent.py
@@ -144,7 +144,7 @@ class TestAllowlistOps:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_tilde_path_approval_records_resolvable_mtime(self, tmp_path, monkeypatch):
"""If the command uses ~ the approval must still find the file."""
monkeypatch.setenv("HOME", str(tmp_path))
diff --git a/tests/agent/test_skill_commands.py b/tests/agent/test_skill_commands.py
index 68b9f30c2a8..691e4c18532 100644
--- a/tests/agent/test_skill_commands.py
+++ b/tests/agent/test_skill_commands.py
@@ -762,7 +762,7 @@ class TestInlineShellExpansion:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_inline_shell_runs_in_skill_directory(self, tmp_path):
"""Inline snippets get the skill dir as CWD so relative paths work."""
with (
diff --git a/tests/agent/test_treekill_consolidation.py b/tests/agent/test_treekill_consolidation.py
index 6812798df11..f48242a994e 100644
--- a/tests/agent/test_treekill_consolidation.py
+++ b/tests/agent/test_treekill_consolidation.py
@@ -135,7 +135,7 @@ class TestCodeExecutionDelegation:
code_execution_tool._kill_process_group(proc)
assert calls == [(5555, _signal.SIGTERM)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_escalate_waits_then_sigkills_tree(self, monkeypatch):
import signal as _signal
diff --git a/tests/ci/test_list_os_marked_tests.py b/tests/ci/test_list_os_marked_tests.py
index d8e0b1bdf55..724fbb2ea36 100644
--- a/tests/ci/test_list_os_marked_tests.py
+++ b/tests/ci/test_list_os_marked_tests.py
@@ -1,11 +1,9 @@
-"""Tests for ``scripts/ci/list_os_marked_tests.py``.
-
-The helper decides which files the macOS / Windows CI lanes import. Its
-failure modes matter more than its happy path: if it silently returned an
-empty list, the OS lane would run zero tests and still report green — the
-exact silent-coverage-loss the lanes exist to prevent. So the contracts under
-test are "finds real markers", "refuses to emit nothing", and "rejects an
-unknown marker".
+"""Tests for scripts/ci/list_os_marked_tests.py.
+
+The properties this tool must keep are "finds real gates", "refuses to emit
+nothing", and "rejects unknown platforms" — the macOS lane imports exactly
+what it emits, so under-selection silently drops coverage while
+over-selection is corrected by the per-test host skips.
"""
from __future__ import annotations
@@ -37,42 +35,37 @@ def _write(root: Path, relpath: str, body: str) -> Path:
return path
- "marker",
- ["linux", "macos", "windows", "linux_only", "macos_only", "windows_only"],
-)
-def test_finds_decorator_and_pytestmark_forms(tmp_path, marker):
- """Decorator and module-level forms are detected, legacy and composable.
-
- Short names (linux/macos/windows) match the composable
- ``platforms("...")`` spec form; the ``_only`` names match the legacy
- decorator/``pytestmark`` forms. Both must also select the other form's
- files when present, so the macOS lane keeps working during the
- incremental migration.
- """
- short = marker in ("linux", "macos", "windows")
- # The canonical form for this marker.
- if short:
- decorated = f'import pytest\n\n\[email protected]("{marker}")\ndef test_x():\n pass\n'
- pytestmark_body = f'import pytest\n\npytestmark = pytest.mark.platforms("{marker}")\n\n\ndef test_y():\n pass\n'
- query = marker
- else:
- decorated = f"import pytest\n\n\[email protected].{marker}\ndef test_x():\n pass\n"
- pytestmark_body = f"import pytest\n\npytestmark = pytest.mark.{marker}\n\n\ndef test_y():\n pass\n"
- query = marker
- _write(tmp_path, "test_decorated.py", decorated)
- _write(tmp_path, "nested/test_module_level.py", pytestmark_body)
- # A file with no marker at all must not be selected.
[email protected]("platform", ["linux", "macos", "windows"])
+def test_finds_decorator_and_pytestmark_forms(tmp_path, platform):
+ """Both the decorator form and module-level ``pytestmark`` are detected."""
+ _write(
+ tmp_path,
+ "test_decorated.py",
+ f'import pytest\n\n\[email protected]("{platform}")\ndef test_x():\n pass\n',
+ )
+ _write(
+ tmp_path,
+ "nested/test_module_level.py",
+ f'import pytest\n\npytestmark = pytest.mark.platforms("{platform}")\n\n\ndef test_y():\n pass\n',
+ )
+ # A file with no gate at all must not be selected.
_write(tmp_path, "test_plain.py", "def test_z():\n pass\n")
- # A platforms() file naming a DIFFERENT platform must not be selected.
- other = "windows" if marker.rstrip("_only") != "windows" else "linux"
+ # A platforms() file gating a DIFFERENT platform must not be selected.
+ other = "windows" if platform != "windows" else "linux"
_write(
tmp_path,
"test_other_platform.py",
f'import pytest\n\n\[email protected]("{other}")\ndef test_w():\n pass\n',
)
+ # A bare identifier that merely LOOKS like the platform name must not
+ # match — the spec has to appear inside the quoted string literal.
+ _write(
+ tmp_path,
+ "test_bare_identifier.py",
+ f"import pytest\n\n\[email protected](\"kind\", [\"{platform}\"])\ndef test_v():\n assert kind\n",
+ )
- result = _run(query, str(tmp_path))
+ result = _run(platform, str(tmp_path))
assert result.returncode == 0, result.stderr
listed = result.stdout.split()
@@ -80,15 +73,16 @@ def test_finds_decorator_and_pytestmark_forms(tmp_path, marker):
assert any(p.endswith("test_module_level.py") for p in listed)
assert not any(p.endswith("test_plain.py") for p in listed)
assert not any(p.endswith("test_other_platform.py") for p in listed)
+ assert not any(p.endswith("test_bare_identifier.py") for p in listed)
def test_negated_spec_lists_for_that_lane(tmp_path):
"""``platforms("not macos")`` lists the file for the macOS lane import.
- The script only decides which files are IMPORTED; the lane's ``-m``
- filter remains authoritative. A negated spec file may still contain
- other tests, so it must be imported on the macOS lane — under-selecting
- is the failure mode this tool exists to prevent.
+ The script only decides which files are IMPORTED; the per-test host
+ skips remain authoritative. A negated-spec file may still contain other
+ tests, so it must be imported on the macOS lane — under-selecting is
+ the failure mode this tool exists to prevent.
"""
_write(
tmp_path,
@@ -103,42 +97,29 @@ def test_negated_spec_lists_for_that_lane(tmp_path):
assert any(p.endswith("test_negated.py") for p in listed)
-def test_marker_matched_as_whole_word(tmp_path):
- """``macos_only`` must not match a longer identifier that contains it."""
+def test_unknown_platform_is_rejected(tmp_path):
+ result = _run("amiga", str(tmp_path))
+ assert result.returncode == 2
+ assert "unknown platform" in result.stderr
+
+
+def test_exits_nonzero_when_no_file_gates_on_the_platform(tmp_path):
+ """A platform with zero gated files must fail, not emit nothing."""
_write(
tmp_path,
- "test_lookalike.py",
- "import pytest\n\n\[email protected]_only_extra\ndef test_x():\n pass\n",
+ "test_unrelated.py",
+ 'import pytest\n\n\[email protected]("linux")\ndef test_x():\n pass\n',
)
- result = _run("macos_only", str(tmp_path))
+ result = _run("macos", str(tmp_path))
# No genuine match: the helper must fail rather than emit nothing.
- assert result.returncode == 1
- assert "macos_only" in result.stderr
-
-
-def test_exits_nonzero_when_no_file_carries_the_marker(tmp_path):
- """The load-bearing guard: an empty result is an error, never a silent pass."""
- _write(tmp_path, "test_plain.py", "def test_z():\n pass\n")
-
- result = _run("windows_only", str(tmp_path))
-
- assert result.returncode == 1
- assert result.stdout.strip() == ""
- assert "renamed or dropped" in result.stderr
-
-
-def test_rejects_unknown_marker(tmp_path):
- result = _run("bsd_only", str(tmp_path))
-
- assert result.returncode == 2
- assert "unknown marker" in result.stderr
+ assert result.returncode != 0
+ assert "no test files" in result.stderr
def test_rejects_missing_root():
- result = _run("macos_only", "/nonexistent/path/for/this/test")
-
+ result = _run("macos", "/nonexistent/path/for/this/test")
assert result.returncode == 2
assert "no such directory" in result.stderr
@@ -151,7 +132,7 @@ def test_emits_repo_relative_posix_paths():
exercises — an out-of-repo root can't be made repo-relative and is
emitted absolute instead.
"""
- result = _run("windows_only")
+ result = _run("windows")
assert result.returncode == 0, result.stderr
listed = result.stdout.split()
@@ -161,17 +142,9 @@ def test_emits_repo_relative_posix_paths():
assert not Path(line).is_absolute()
-def test_real_tree_selects_files_for_every_marker():
- """Against the actual ``tests/`` tree each marker resolves to real files.
-
- This is the invariant the CI lanes depend on — not a snapshot of which
- files those are, only that each marker is in use and every listed path
- exists.
- """
- for marker in ("linux_only", "macos_only", "windows_only"):
- result = _run(marker)
- assert result.returncode == 0, f"{marker}: {result.stderr}"
- listed = result.stdout.split()
- assert listed, f"{marker} selected no files"
- for rel in listed:
- assert (REPO_ROOT / rel).is_file(), f"{marker} listed missing {rel}"
+def test_real_tree_selects_files_for_every_platform():
+ """Against the actual ``tests/`` tree each platform resolves to real files."""
+ for platform in ("linux", "macos", "windows"):
+ result = _run(platform)
+ assert result.returncode == 0, (platform, result.stderr)
+ assert result.stdout.split(), f"{platform} selected nothing in the real tree"
diff --git a/tests/cli/test_bang_shell_mode.py b/tests/cli/test_bang_shell_mode.py
index bc369372de6..d9a197c32ac 100644
--- a/tests/cli/test_bang_shell_mode.py
+++ b/tests/cli/test_bang_shell_mode.py
@@ -89,7 +89,7 @@ class TestBangContextGating:
# ── execution ──────────────────────────────────────────────────────────────
class TestBangExecution:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_output_is_streamed_to_writer(self):
lines = []
code = run_bang_command("echo bang-one; echo bang-two", writer=lines.append)
@@ -97,7 +97,7 @@ class TestBangExecution:
assert "bang-one" in lines
assert "bang-two" in lines
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_stderr_is_merged_into_output(self):
lines = []
run_bang_command("echo to-stderr >&2", writer=lines.append)
@@ -108,7 +108,7 @@ class TestBangExecution:
code = run_bang_command("exit 42", writer=lines.append)
assert code == 42
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_runs_in_requested_cwd(self, tmp_path):
lines = []
code = run_bang_command("pwd", cwd=str(tmp_path), writer=lines.append)
diff --git a/tests/cli/test_cli_file_drop.py b/tests/cli/test_cli_file_drop.py
index e08e37f95f6..cf0477fe5c2 100644
--- a/tests/cli/test_cli_file_drop.py
+++ b/tests/cli/test_cli_file_drop.py
@@ -168,10 +168,10 @@ class TestEscapedSpaces:
assert result["remainder"] == "what is this?"
- # ``windows_only`` rather than ``skipif(os.name != "nt")``: the Windows CI
- # job selects ``-m windows_only``, so a bare skipif would leave this
+ # ``platforms("windows")`` rather than ``skipif(os.name != "nt")``: the Windows CI
+ # job selects ``-m platforms("windows")``, so a bare skipif would leave this
# skipped on Linux AND unselected there — dead on every host.
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_drive_letter_file_uri_drops_url_leading_slash(self, tmp_path):
image = tmp_path / "drive-uri.png"
image.write_bytes(b"\x89PNG\r\n\x1a\n")
diff --git a/tests/cli/test_cli_init.py b/tests/cli/test_cli_init.py
index 4badd60691f..8234a58f427 100644
--- a/tests/cli/test_cli_init.py
+++ b/tests/cli/test_cli_init.py
@@ -154,7 +154,7 @@ class TestBusyInputMode:
class TestPromptToolkitTerminalCompatibility:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_lf_enter_binding_respects_multiline_shortcuts(self):
"""Ctrl+J is reserved by default, with legacy LF-submit available as an opt-out.
@@ -223,7 +223,7 @@ class TestPromptToolkitTerminalCompatibility:
assert bindings[("c-m",)] is submit_handler
assert ("c-j",) not in bindings
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_leaves_ctrl_j_unbound(self):
"""On native Windows only enter submits; c-j is free for the newline
binding added separately in the prompt setup."""
@@ -252,13 +252,13 @@ class TestPromptToolkitTerminalCompatibility:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cpr_gating_posix_suppresses_without_ssh(self, monkeypatch):
"""POSIX suppresses CPR without SSH.
The native-Windows arm (``_terminal_may_leak_cpr() is False``, plus
the ``PROMPT_TOOLKIT_NO_CPR`` override that outranks it) lives in
- ``tests/cli/test_cpr_local_leak.py`` under ``windows_only``, where it
+ ``tests/cli/test_cpr_local_leak.py`` under ``platforms("windows")``, where it
runs against a real Windows console.
"""
from cli import _terminal_may_leak_cpr
diff --git a/tests/cli/test_cli_light_mode.py b/tests/cli/test_cli_light_mode.py
index a8ef9f208bd..a8b28e13c02 100644
--- a/tests/cli/test_cli_light_mode.py
+++ b/tests/cli/test_cli_light_mode.py
@@ -176,7 +176,7 @@ class TestSkinConfigHook:
assert skin.get_color("banner_text") == "#FFF8DC"
class TestOsc11DrainGuard:
"""Regression: a late-arriving OSC 11 reply must not leak into
prompt_toolkit's input buffer (#40250).
diff --git a/tests/cli/test_cpr_local_leak.py b/tests/cli/test_cpr_local_leak.py
index 3d636e00b58..37340e8d295 100644
--- a/tests/cli/test_cpr_local_leak.py
+++ b/tests/cli/test_cpr_local_leak.py
@@ -33,12 +33,12 @@ def _clear_cpr_env(monkeypatch):
class TestClassicCliOutputSelection:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_preserves_default_output_selection(self):
assert _terminal_may_leak_cpr() is False
assert _select_classic_cli_pt_output(sys.stdout) is None
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_honors_explicit_no_cpr(self, monkeypatch):
monkeypatch.setenv("PROMPT_TOOLKIT_NO_CPR", "1")
assert _terminal_may_leak_cpr() is True
diff --git a/tests/cli/test_ctrl_enter_newline.py b/tests/cli/test_ctrl_enter_newline.py
index a7eaef77261..bb88795f1ee 100644
--- a/tests/cli/test_ctrl_enter_newline.py
+++ b/tests/cli/test_ctrl_enter_newline.py
@@ -11,7 +11,7 @@ These tests pin the gating predicate and the resulting binding behavior.
``_preserve_ctrl_enter_newline()`` short-circuits to True on native Windows
before it ever looks at the environment, so the env-driven cases below are
POSIX assertions and run on the Linux job. The native-Windows short-circuit
-is marked ``windows_only`` and asserted on the real host — patching
+is marked ``platforms("windows")`` and asserted on the real host — patching
``sys.platform`` to ``"win32"`` here would only re-assert the literal in the
``if``, on an interpreter where none of the Windows terminal behaviour it
exists for is present.
@@ -52,7 +52,7 @@ def _bind_submit_keys_for_local_linux(cli_mod, *, multiline_shortcuts_enabled):
return kb
def test_native_windows_preserves_newline():
import cli as cli_mod
@@ -211,11 +211,11 @@ def test_non_ghostty_terminals_still_push_kitty_protocol():
assert b"\x1b[>4;2m" in out.written
def test_proc_version_microsoft_marker_preserves_newline():
"""WSL detection via /proc when env vars are scrubbed (sudo etc.).
- ``linux_only``: the fallback reads ``/proc/version`` — a Linux-only
+ ``platforms("linux")``: the fallback reads ``/proc/version`` — a Linux-only
interface, and the WSL kernels it sniffs for are Linux kernels.
"""
import cli as cli_mod
diff --git a/tests/cli/test_slash_confirm_windows.py b/tests/cli/test_slash_confirm_windows.py
index 6563162870f..962d1950d73 100644
--- a/tests/cli/test_slash_confirm_windows.py
+++ b/tests/cli/test_slash_confirm_windows.py
@@ -16,7 +16,7 @@ These tests verify:
(on win32, off-thread) a scheduling failure degrades to a clean cancel.
4. Empty choices returns None.
-**Why the Windows cases are ``windows_only`` rather than ``sys.platform``
+**Why the Windows cases are ``platforms("windows")`` rather than ``sys.platform``
patches.** The deadlock #33961 fixed is a real property of the Windows console:
a raw ``input()`` off the main thread blocks forever against prompt_toolkit's
stdin ownership. On Linux the same call returns immediately (or EOFs), so a test
@@ -151,7 +151,7 @@ class TestModal:
mock_stdin.assert_not_called()
assert result == "once"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_scheduling_failure_clean_cancels(self):
"""win32 off the main thread: if marshaling onto the app loop fails, cancel
cleanly (None) rather than fall to raw input() (which deadlocks on native
@@ -183,7 +183,7 @@ class TestConfirmDestructiveSlash:
This is the flow bug #33961 froze on native Windows. The fix made it
platform-agnostic (modal via the app loop), so the assertion holds on
whichever host runs it. The class carries no OS marker, so the
- ``windows_only`` lane deselects it — the deadlock tests above are the
+ ``platforms("windows")`` lane deselects it — the deadlock tests above are the
Windows-side regression guard.
"""
@@ -222,7 +222,7 @@ class TestConfirmDestructiveSlash:
assert outcome["result"] == expected
class TestNativeWindowsNoRawInputDeadlock:
"""Anti-regression guard exercising the REAL ``_prompt_text_input``.
@@ -238,7 +238,7 @@ class TestNativeWindowsNoRawInputDeadlock:
pre-#33961 code (win32 → ``_prompt_text_input`` → off-main ``input()``)
and pass once the modal path / clean-cancel fallback is in place.
- ``windows_only``: the deadlock is a property of the Windows console's stdin
+ ``platforms("windows")``: the deadlock is a property of the Windows console's stdin
ownership. Running this with a patched ``sys.platform`` on Linux exercises
a blocking ``input()`` that does not actually deadlock there, so it could
never have caught the regression it is named for.
diff --git a/tests/cli/test_worktree.py b/tests/cli/test_worktree.py
index e06ee84bd12..4f7702d87f5 100644
--- a/tests/cli/test_worktree.py
+++ b/tests/cli/test_worktree.py
@@ -1342,7 +1342,7 @@ class TestShallowCloneDeepening:
)
class TestPrMergedEscapeHatch:
"""Rebase-merged PRs whose diff changed during salvage defeat ``git
cherry`` (patch-id mismatch), so the pruner asks GitHub whether the
diff --git a/tests/computer_use/test_cua_no_overlay.py b/tests/computer_use/test_cua_no_overlay.py
index 12582a34a2e..f5f15ca0696 100644
--- a/tests/computer_use/test_cua_no_overlay.py
+++ b/tests/computer_use/test_cua_no_overlay.py
@@ -30,7 +30,7 @@ class TestNoOverlayFlag:
assert cua_backend._cua_no_overlay() is True
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_config_load_failure_falls_through_to_auto_detect_macos(self):
"""Unreadable config => auto-detect (macOS defaults to overlay off).
@@ -41,7 +41,7 @@ class TestNoOverlayFlag:
side_effect=RuntimeError("boom")):
assert cua_backend._cua_no_overlay() is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_config_load_failure_falls_through_to_auto_detect_linux(self, monkeypatch):
"""Unreadable config must not raise; headless Linux auto-detects off.
@@ -53,7 +53,7 @@ class TestNoOverlayFlag:
side_effect=RuntimeError("boom")):
assert cua_backend._cua_no_overlay() is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_linux_x11_auto_detects_off(self, monkeypatch):
"""X11 desktop (DISPLAY set, no Wayland) defaults the overlay off.
@@ -68,7 +68,7 @@ class TestNoOverlayFlag:
with patch("hermes_cli.config.load_config", return_value={}):
assert cua_backend._cua_no_overlay() is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_linux_x11_explicit_session_type_also_off(self, monkeypatch):
"""XDG_SESSION_TYPE=x11 without Wayland env is still X11."""
monkeypatch.setenv("DISPLAY", ":0")
@@ -77,7 +77,7 @@ class TestNoOverlayFlag:
with patch("hermes_cli.config.load_config", return_value={}):
assert cua_backend._cua_no_overlay() is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_linux_wayland_keeps_overlay(self, monkeypatch):
"""Wayland desktop keeps the overlay: the compositor owns the
overlay surface lifecycle, so it cannot get stuck above every
@@ -88,7 +88,7 @@ class TestNoOverlayFlag:
with patch("hermes_cli.config.load_config", return_value={}):
assert cua_backend._cua_no_overlay() is False
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_linux_x11_explicit_false_overrides_auto_detect(self, monkeypatch):
"""An explicit ``no_overlay: false`` must restore the cursor even on
X11 — auto-detection is the default, never a hard lock."""
diff --git a/tests/conformance/persistence/test_cell1_prefix_durability.py b/tests/conformance/persistence/test_cell1_prefix_durability.py
index 8af5ac6da0c..5f47b5fe582 100644
--- a/tests/conformance/persistence/test_cell1_prefix_durability.py
+++ b/tests/conformance/persistence/test_cell1_prefix_durability.py
@@ -75,7 +75,7 @@ def _recover(db_path: Path) -> list[tuple]:
@pytest.mark.parametrize("requested_mode", [None, "DELETE", "WAL"])
def test_acknowledged_appends_survive_sigkill(tmp_path, requested_mode):
db_path = tmp_path / "state.db"
journal = tmp_path / "acked.jsonl"
diff --git a/tests/conformance/persistence/test_cell3_rotation_atomicity.py b/tests/conformance/persistence/test_cell3_rotation_atomicity.py
index 94e1149d425..9a829404138 100644
--- a/tests/conformance/persistence/test_cell3_rotation_atomicity.py
+++ b/tests/conformance/persistence/test_cell3_rotation_atomicity.py
@@ -78,7 +78,7 @@ def _completed_rotations(journal: Path) -> int:
@pytest.mark.parametrize("requested_mode", [None, "DELETE", "WAL"])
def test_rotation_is_atomic_under_sigkill(tmp_path, requested_mode):
db_path = tmp_path / "state.db"
journal = tmp_path / "rotations.jsonl"
diff --git a/tests/conftest.py b/tests/conftest.py
index 1f74ac20b3f..c3ebdc9e277 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1103,12 +1103,12 @@ _ALLOW_MACOS_KEYCHAIN_MARK = "allow_macos_keychain"
# So: a test whose subject is genuinely OS-specific declares the OS it
# belongs to and runs there for real —
#
-# @pytest.mark.windows_only → only on native Windows (``sys.platform == "win32"``)
-# @pytest.mark.macos_only → only on macOS (``sys.platform == "darwin"``)
-# @pytest.mark.linux_only → only on Linux (``sys.platform.startswith("linux")``)
+# @pytest.mark.platforms("windows") → only on native Windows (``sys.platform == "win32"``)
+# @pytest.mark.platforms("macos") → only on macOS (``sys.platform == "darwin"``)
+# @pytest.mark.platforms("linux") → only on Linux (``sys.platform.startswith("linux")``)
#
# Elsewhere the test is skipped, not faked. CI runs a dedicated macOS job
-# (``-m macos_only``) and a dedicated Windows job (``-m windows_only``) so
+# (``-m platforms("macos")``) and a dedicated Windows job (``-m platforms("windows")``) so
# those markers are actually exercised on their own host rather than
# quietly skipped everywhere.
#
@@ -1128,47 +1128,6 @@ _ALLOW_MACOS_KEYCHAIN_MARK = "allow_macos_keychain"
# another OS in order to pass, it belongs on that OS.
# ---------------------------------------------------------------------------
-_OS_MARKS = {
- "linux_only": (
- lambda: sys.platform.startswith("linux"),
- "Linux",
- ),
- "macos_only": (
- lambda: sys.platform == "darwin",
- "macOS",
- ),
- "windows_only": (
- lambda: sys.platform == "win32",
- "native Windows",
- ),
-}
-
-
-# ── Composable platform gating ──────────────────────────────────────────────
-# The fixed trio above can only say "one OS, no qualifiers". Real host-gating
-# needs more: "anything except macOS", "Windows but only arm64", "POSIX-family
-# behaviour". The ``platforms`` marker takes any number of spec strings plus
-# optional arch filters, and runs the test only where at least one spec
-# matches the host:
-#
-# @pytest.mark.platforms("linux") only on Linux
-# @pytest.mark.platforms("not macos") anywhere except macOS
-# @pytest.mark.platforms("windows", arch="arm64") native Windows on arm64
-# @pytest.mark.platforms("posix") linux or macOS
-#
-# Spec grammar (one per marker argument, case-insensitive):
-# "linux" | "macos" | "windows" — exact OS
-# "posix" — linux or macOS
-# "not <spec>" — negation of a single spec
-# "any" — always true (documentation form)
-# ``arch`` narrows by machine architecture ("arm64", "x86_64", ...) matched
-# case-insensitively against platform.machine() aliases (amd64 → x86_64,
-# aarch64 → arm64). ``arch_negate=True`` inverts the arch filter.
-#
-# The old trio remains accepted as aliases routing through the same skip
-# machinery; new tests should prefer ``platforms``. A mechanical rewrite of
-# the ~500 legacy call sites is a separate sweep.
-
_PLATFORM_ALIASES = {
"linux": ("linux",),
"macos": ("darwin", "macos"),
@@ -1292,7 +1251,7 @@ def pytest_configure(config): # noqa: D401 — pytest hook
"dispatcher's memory guard to 'no data' — only for tests that "
"exercise the guard itself with their own patched samples.",
)
- # NOTE: linux_only / macos_only / windows_only are declared in
+ # NOTE: platforms("linux") / platforms("macos") / platforms("windows") are declared in
# pyproject.toml's ``markers`` list, not here — they are part of the
# project's public marker vocabulary (``pytest --markers``, and the CI
# lanes select on them), whereas the marks above are conftest-internal
@@ -1338,59 +1297,52 @@ def pytest_runtest_setup(item):
)
-def _reject_multiple_os_marks(items):
- """Fail collection when one test carries two host-OS markers.
+def _reject_contradictory_platform_marks(items):
+ """Fail collection when one test carries two platforms() markers.
- Every marker in ``_OS_MARKS`` skips on all but one host, so two of them
- on the same item means it is skipped on *every* host — a test that never
- runs anywhere, reported as green by both the Linux suite and the
- tests-os lanes. That is the exact silent-coverage-loss the markers were
- introduced to remove, so it is a hard collection error rather than a
- warning nobody reads.
+ Two markers are ANDed by the gate, so a stacked pair is not always wrong
+ in principle — but the historic failure this guard exists for (a
+ module-level gate stacking with a per-test gate so the test is skipped
+ on every host while both lanes report green) is only diagnosable at
+ collection time. A test that needs a compound condition writes ONE
+ marker: platforms("linux", arch="arm64").
"""
offenders = []
for item in items:
- marks = sorted({m.name for m in item.iter_markers() if m.name in _OS_MARKS})
+ marks = list(item.iter_markers("platforms"))
if len(marks) > 1:
- offenders.append(f" {item.nodeid}: {', '.join(marks)}")
+ offenders.append(f" {item.nodeid}: {len(marks)} platforms() marks")
if offenders:
raise pytest.UsageError(
- "a test may carry at most one host-OS marker "
- f"({', '.join(_OS_MARKS)}); these carry several and would be "
- "skipped on every host:\n" + "\n".join(offenders)
+ "a test may carry at most one platforms() marker — combine the "
+ 'specs into one call (platforms("linux", arch="arm64") instead '
+ "of stacking two markers); these carry several:\n"
+ + "\n".join(offenders)
)
def pytest_collection_modifyitems(config, items): # noqa: D401 — pytest hook
"""Apply host-OS gating, then skip ``requires_wal`` where WAL is unusable.
- OS gating: a test marked ``linux_only`` / ``macos_only`` /
- ``windows_only`` runs only on that host. See the ``_OS_MARKS`` block
- comment above for why these tests are skipped rather than run against a
- patched ``sys.platform``.
+ OS gating: a test marked ``platforms(...)`` runs only on hosts its
+ specs match. See the platform-gating block comment above for why these
+ tests are skipped rather than run against a patched ``sys.platform``.
WAL gating is cheaper and more honest than each test hand-rolling a
version check: the reason string names the actual linked version so the
skip is diagnosable rather than mysterious.
"""
- _reject_multiple_os_marks(items)
+ _reject_contradictory_platform_marks(items)
- # Composable platforms() gating: skip items whose specs exclude this host.
+ # platforms() gating: skip items whose specs exclude this host. The skip
+ # markers (not -m expressions) are the authoritative host filter on
+ # every lane, so a lane selects with plain ``-m platforms`` and lets the
+ # specs decide per-test.
for item in items:
reason = _platforms_gate_reason(item)
if reason is not None:
item.add_marker(pytest.mark.skip(reason=reason))
- for mark_name, (is_host, label) in _OS_MARKS.items():
- if is_host():
- continue
- skip_os = pytest.mark.skip(
- reason=f"{label}-only test (marked {mark_name}); host is {sys.platform}"
- )
- for item in items:
- if item.get_closest_marker(mark_name) is not None:
- item.add_marker(skip_os)
-
if _wal_is_usable():
return
diff --git a/tests/cron/test_cron_script.py b/tests/cron/test_cron_script.py
index 5c51134d25b..c5ff375ce35 100644
--- a/tests/cron/test_cron_script.py
+++ b/tests/cron/test_cron_script.py
@@ -133,7 +133,7 @@ class TestRunJobScript:
assert success is True
assert output == "ABSENT"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_uv_venv_python_script_bypasses_launcher(self, cron_env, tmp_path, monkeypatch):
# Windows-only: the fake ``sys.platform`` could not reproduce the
# ``Scripts/python.exe`` launcher layout or the CREATE_NO_WINDOW
diff --git a/tests/cron/test_cron_workdir.py b/tests/cron/test_cron_workdir.py
index ecf19611327..5eb4c0a8140 100644
--- a/tests/cron/test_cron_workdir.py
+++ b/tests/cron/test_cron_workdir.py
@@ -45,7 +45,7 @@ class TestNormalizeWorkdir:
result = _normalize_workdir(str(tmp_path))
assert result == str(tmp_path.resolve())
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_tilde_expands(self, tmp_path, monkeypatch):
from cron.jobs import _normalize_workdir
monkeypatch.setenv("HOME", str(tmp_path))
diff --git a/tests/cron/test_file_permissions.py b/tests/cron/test_file_permissions.py
index c05b35842e0..969e3d2fb1a 100644
--- a/tests/cron/test_file_permissions.py
+++ b/tests/cron/test_file_permissions.py
@@ -9,7 +9,7 @@ from unittest.mock import patch
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
class TestCronFilePermissions(unittest.TestCase):
diff --git a/tests/cron/test_script_claim_heartbeat.py b/tests/cron/test_script_claim_heartbeat.py
index 93cb8b659fa..b9fb0ca0728 100644
--- a/tests/cron/test_script_claim_heartbeat.py
+++ b/tests/cron/test_script_claim_heartbeat.py
@@ -10,7 +10,7 @@ from unittest.mock import MagicMock, patch
import pytest
def test_cancel_event_terminates_script_process_tree(tmp_path, monkeypatch):
"""Losing a fire claim must stop both the script and its descendants."""
import cron.scheduler as scheduler
diff --git a/tests/gateway/test_complete_path_at_filter.py b/tests/gateway/test_complete_path_at_filter.py
index 28479e11135..5e764ca9f42 100644
--- a/tests/gateway/test_complete_path_at_filter.py
+++ b/tests/gateway/test_complete_path_at_filter.py
@@ -223,7 +223,7 @@ def test_leading_slash_matches_the_bare_form(tmp_path, monkeypatch):
assert slashed == bare
def test_leading_slash_prefers_a_real_absolute_path(tmp_path, monkeypatch):
"""When the absolute reading resolves, it wins — no silent rewrite.
diff --git a/tests/gateway/test_platform_base.py b/tests/gateway/test_platform_base.py
index 7bddb00edc9..41a34cf2375 100644
--- a/tests/gateway/test_platform_base.py
+++ b/tests/gateway/test_platform_base.py
@@ -787,7 +787,7 @@ class TestMediaDeliveryDefaultMode:
assert BasePlatformAdapter.validate_media_delivery_path(str(link)) is None
class TestDockerContainerMediaPathTranslation:
"""MEDIA:/workspace (and configured mounts) must resolve to host paths."""
@@ -1327,7 +1327,7 @@ class TestMediaFallbackDoesNotLeakHostPath:
assert self.SENSITIVE_PATH not in sent_text
class TestDockerProfileSandboxMediaTranslation:
"""MEDIA from persistent Docker sandboxes must resolve to the host
directory the profile's container actually bind-mounts (#93950).
diff --git a/tests/gateway/test_replace_child_reap.py b/tests/gateway/test_replace_child_reap.py
index 99d16ca374d..2700e289d3c 100644
--- a/tests/gateway/test_replace_child_reap.py
+++ b/tests/gateway/test_replace_child_reap.py
@@ -64,7 +64,7 @@ def _fake_psutil(monkeypatch, *, wait_gone=None, wait_alive=None):
return fake
class TestReapGatewayChildren:
def test_reaps_orphaned_children_sigterm_then_wait(self, monkeypatch):
fake = _fake_psutil(monkeypatch)
@@ -88,7 +88,7 @@ class TestReapGatewayChildren:
assert reaped == 1
class TestSnapshotGatewayChildren:
def test_snapshot_walks_descendants_recursively(self, monkeypatch):
fake = _fake_psutil(monkeypatch)
diff --git a/tests/gateway/test_restart_drain.py b/tests/gateway/test_restart_drain.py
index 0d643e65719..d5d6b855864 100644
--- a/tests/gateway/test_restart_drain.py
+++ b/tests/gateway/test_restart_drain.py
@@ -265,7 +265,7 @@ async def test_run_restart_excluded_from_stop_cancel_loop():
)
@pytest.mark.asyncio
async def test_windows_detached_restart_scrubs_gateway_marker(monkeypatch, tmp_path):
"""Faking sys.platform="win32" on Linux could not reach the real Windows
@@ -308,7 +308,7 @@ async def test_windows_detached_restart_scrubs_gateway_marker(monkeypatch, tmp_p
assert kwargs["stderr"] is subprocess.DEVNULL
@pytest.mark.asyncio
async def test_windows_detached_restart_watcher_keeps_console_python(monkeypatch, tmp_path):
"""The restart watcher must run sys.executable (console python) under the
diff --git a/tests/gateway/test_scale_to_zero.py b/tests/gateway/test_scale_to_zero.py
index d38af57b6e8..622081151cc 100644
--- a/tests/gateway/test_scale_to_zero.py
+++ b/tests/gateway/test_scale_to_zero.py
@@ -150,7 +150,7 @@ def _fake_flaps(tmp_path, status_line, capture):
return sock_path, t
def test_suspend_self_posts_suspend_for_this_machine(tmp_path):
captured: list[bytes] = []
sock_path, t = _fake_flaps(tmp_path, "200 OK", captured)
@@ -165,7 +165,7 @@ def test_suspend_self_posts_suspend_for_this_machine(tmp_path):
assert "Host: flaps\r\n" in request
def test_suspend_self_non_2xx_is_false_not_raise(tmp_path):
captured: list[bytes] = []
sock_path, t = _fake_flaps(tmp_path, "412 Precondition Failed", captured)
@@ -173,7 +173,7 @@ def test_suspend_self_non_2xx_is_false_not_raise(tmp_path):
t.join(timeout=5)
def test_suspend_self_missing_socket_is_false_not_raise(tmp_path):
# Fail-awake: a dead/absent flaps socket must never raise out of the watcher.
assert suspend_self(_FLY_ENV, socket_path=str(tmp_path / "nope.sock")) is False
diff --git a/tests/gateway/test_status.py b/tests/gateway/test_status.py
index 6ca006ca0b9..c6a9ab0bf32 100644
--- a/tests/gateway/test_status.py
+++ b/tests/gateway/test_status.py
@@ -390,7 +390,7 @@ class TestGetProcessStartTime:
class TestTerminatePid:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_force_uses_taskkill_on_windows(self, monkeypatch):
# Faking _IS_WINDOWS on POSIX could not reproduce the real
# CREATE_NO_WINDOW creationflags value that windows_hide_flags()
@@ -438,7 +438,7 @@ class TestTerminatePid:
class TestScopedLocks:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_file_lock_uses_high_offset(self, tmp_path, monkeypatch):
# Faking _IS_WINDOWS on POSIX could not reproduce the msvcrt
# byte-range locking path at all: msvcrt does not exist off Windows,
@@ -1059,7 +1059,7 @@ class TestPlannedStopMarker:
class TestReadProcessCmdlinePsFallback:
"""Tests for _read_process_cmdline falling back to ps on non-Linux."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_ps_fallback_when_proc_unavailable(self, monkeypatch):
monkeypatch.setattr(status.Path, "read_bytes", lambda self: (_ for _ in ()).throw(FileNotFoundError))
monkeypatch.setattr(
diff --git a/tests/gateway/test_systemd_notify.py b/tests/gateway/test_systemd_notify.py
index 6903f1a0d54..a8dcd2f3606 100644
--- a/tests/gateway/test_systemd_notify.py
+++ b/tests/gateway/test_systemd_notify.py
@@ -7,7 +7,7 @@ import socket
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
@pytest.mark.skipif(
diff --git a/tests/gateway/test_update_command.py b/tests/gateway/test_update_command.py
index 18cdea9a07e..72796cb9608 100644
--- a/tests/gateway/test_update_command.py
+++ b/tests/gateway/test_update_command.py
@@ -138,7 +138,7 @@ class TestHandleUpdateCommand:
@pytest.mark.asyncio
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
async def test_fallback_when_no_setsid(self, tmp_path):
"""Falls back to start_new_session=True when setsid is not available."""
runner = _make_runner()
diff --git a/tests/gateway/test_update_streaming.py b/tests/gateway/test_update_streaming.py
index e4f743c28b8..940ab9646bd 100644
--- a/tests/gateway/test_update_streaming.py
+++ b/tests/gateway/test_update_streaming.py
@@ -130,7 +130,7 @@ class TestUpdateCommandGatewayFlag:
"""Verify the gateway spawns hermes update --gateway."""
@pytest.mark.asyncio
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
async def test_spawns_with_gateway_flag(self, tmp_path):
"""The spawned update command includes --gateway and PYTHONUNBUFFERED."""
runner = _make_runner()
diff --git a/tests/gateway/test_whatsapp_connect.py b/tests/gateway/test_whatsapp_connect.py
index 756282ba294..32a22e94789 100644
--- a/tests/gateway/test_whatsapp_connect.py
+++ b/tests/gateway/test_whatsapp_connect.py
@@ -315,9 +315,9 @@ class TestBridgeRuntimeFailure:
class TestKillPortProcess:
"""Verify _kill_port_process uses platform-appropriate commands."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_uses_netstat_and_taskkill_on_windows(self):
- """``windows_only``: netstat/taskkill are Windows binaries. The old
+ """``platforms("windows")``: netstat/taskkill are Windows binaries. The old
``_IS_WINDOWS`` patch selected this branch on Linux, where neither
exists, so the mocked argv was the only thing under test."""
from plugins.platforms.whatsapp.adapter import _kill_port_process
@@ -352,7 +352,7 @@ class TestKillPortProcess:
for call in mock_run.call_args_list
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_refuses_taskkill_on_non_bridge_pid(self):
"""#89614 class: the netstat-scanned PID is a bare number — if the
live process is not a node bridge, taskkill must never fire."""
@@ -378,7 +378,7 @@ class TestKillPortProcess:
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_kills_only_listeners_on_linux(self):
"""POSIX path SIGTERMs only LISTENer PIDs (never clients) — the #43846 fix.
@@ -387,7 +387,7 @@ class TestKillPortProcess:
processes (a browser tab on the same port). The implementation now
resolves listeners via ``_listener_pids_on_port`` and signals only those.
- ``linux_only``: asserts the POSIX ``os.kill``/SIGTERM path, which is
+ ``platforms("linux")``: asserts the POSIX ``os.kill``/SIGTERM path, which is
genuinely selected here without patching ``_IS_WINDOWS``.
"""
from plugins.platforms.whatsapp import adapter as wa
@@ -404,7 +404,7 @@ class TestKillPortProcess:
mock_listeners.assert_called_once_with(3000)
assert kills == [(55555, signal.SIGTERM)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_non_bridge_listener_is_never_killed(self):
"""#89614 class: a listener that is not a node bridge is refused."""
from plugins.platforms.whatsapp import adapter as wa
@@ -429,11 +429,11 @@ class TestHttpSessionLifecycle:
"""Verify persistent aiohttp.ClientSession is created and cleaned up."""
@pytest.mark.asyncio
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
async def test_disconnect_uses_taskkill_tree_on_windows(self):
"""Windows disconnect should target the bridge process tree, not just the parent PID.
- ``windows_only``: ``taskkill /T`` is the Windows tree-kill primitive;
+ ``platforms("windows")``: ``taskkill /T`` is the Windows tree-kill primitive;
on Linux the branch was reachable only by faking ``_IS_WINDOWS``.
"""
adapter = _make_adapter()
diff --git a/tests/hermes_cli/test_auth_nous_provider.py b/tests/hermes_cli/test_auth_nous_provider.py
index 19bb89b576b..657f3e72aa7 100644
--- a/tests/hermes_cli/test_auth_nous_provider.py
+++ b/tests/hermes_cli/test_auth_nous_provider.py
@@ -889,7 +889,7 @@ def test_shared_store_seat_belt_refuses_real_home_under_pytest(monkeypatch):
_nous_shared_store_path()
def test_shared_store_write_and_read_roundtrip(shared_store_env):
"""Write → read must preserve refresh_token + OAuth URLs."""
from hermes_cli.auth import (
diff --git a/tests/hermes_cli/test_auth_ssl_macos.py b/tests/hermes_cli/test_auth_ssl_macos.py
index 9d9abc1dbfe..2320af0addc 100644
--- a/tests/hermes_cli/test_auth_ssl_macos.py
+++ b/tests/hermes_cli/test_auth_ssl_macos.py
@@ -48,13 +48,13 @@ def real_bundle_file(tmp_path: Path) -> str:
class TestDefaultVerify:
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_returns_ssl_context_on_darwin(self):
result = _default_verify()
assert isinstance(result, ssl.SSLContext)
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_darwin_falls_back_to_true_when_certifi_missing(self, monkeypatch):
real_import = __import__
@@ -71,7 +71,7 @@ class TestResolveVerifyIntegration:
"""_resolve_verify should defer to _default_verify in the no-CA path."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_no_ca_uses_default_verify_on_linux(self, monkeypatch):
for var in ("HERMES_CA_BUNDLE", "SSL_CERT_FILE", "REQUESTS_CA_BUNDLE"):
monkeypatch.delenv(var, raising=False)
diff --git a/tests/hermes_cli/test_auth_store_lock_concurrent.py b/tests/hermes_cli/test_auth_store_lock_concurrent.py
index 30788abe170..584c637dd20 100644
--- a/tests/hermes_cli/test_auth_store_lock_concurrent.py
+++ b/tests/hermes_cli/test_auth_store_lock_concurrent.py
@@ -39,7 +39,7 @@ def hermes_home(tmp_path, monkeypatch):
return tmp_path
def test_many_concurrent_lock_acquisitions_do_not_raise_permission_error(hermes_home):
"""CONCURRENCY threads race to acquire/release the same auth-store lock.
diff --git a/tests/hermes_cli/test_backup.py b/tests/hermes_cli/test_backup.py
index dd3030c4143..6f5424c8d7d 100644
--- a/tests/hermes_cli/test_backup.py
+++ b/tests/hermes_cli/test_backup.py
@@ -1823,7 +1823,7 @@ class TestMemoryProviderExternalPaths:
(outside / "leak.json").unlink()
outside.rmdir()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_import_restores_external_to_home_relative_location(self, tmp_path, monkeypatch):
"""_external/ members restore to ~/<relpath>, not under HERMES_HOME,
and credential-shaped files get 0600."""
diff --git a/tests/hermes_cli/test_claw.py b/tests/hermes_cli/test_claw.py
index f12ea500ef2..79891f3b2dd 100644
--- a/tests/hermes_cli/test_claw.py
+++ b/tests/hermes_cli/test_claw.py
@@ -350,7 +350,7 @@ class TestPrintMigrationReport:
class TestDetectOpenclawProcesses:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_returns_match_when_pgrep_finds_openclaw(self):
with patch.object(claw_mod, "subprocess") as mock_subprocess:
# systemd check misses, pgrep finds openclaw
@@ -364,7 +364,7 @@ class TestDetectOpenclawProcesses:
assert "1234" in result[0]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_returns_empty_on_windows_when_nothing_found(self):
"""Faking win32 picked the tasklist/powershell branch on a host that has
neither; only a real Windows host resolves those executables.
diff --git a/tests/hermes_cli/test_clipboard_text_write.py b/tests/hermes_cli/test_clipboard_text_write.py
index 379ab5b798e..5ef8ceae894 100644
--- a/tests/hermes_cli/test_clipboard_text_write.py
+++ b/tests/hermes_cli/test_clipboard_text_write.py
@@ -17,7 +17,7 @@ def _completed(returncode=0):
return subprocess.CompletedProcess(args=[], returncode=returncode)
def test_darwin_uses_pbcopy():
with patch.object(clip.subprocess, "run", return_value=_completed()) as run:
assert clip.write_clipboard_text("hello") is True
@@ -26,7 +26,7 @@ def test_darwin_uses_pbcopy():
assert run.call_args[1]["input"] == b"hello"
def test_linux_falls_through_backends_until_success():
calls = []
diff --git a/tests/hermes_cli/test_config.py b/tests/hermes_cli/test_config.py
index 3c8120f92d0..d3756050fa0 100644
--- a/tests/hermes_cli/test_config.py
+++ b/tests/hermes_cli/test_config.py
@@ -1305,7 +1305,7 @@ class TestEnvWriteDenylist:
assert _env_line_defines_key(line, "PATH", is_windows=True)
assert not _env_line_defines_key(line, "PATH", is_windows=False)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
@pytest.mark.parametrize(
"protected_key",
[
diff --git a/tests/hermes_cli/test_container_boot.py b/tests/hermes_cli/test_container_boot.py
index 543cc2bb3c6..8134af5a9cf 100644
--- a/tests/hermes_cli/test_container_boot.py
+++ b/tests/hermes_cli/test_container_boot.py
@@ -19,7 +19,7 @@ from hermes_cli.container_boot import (
reconcile_profile_gateways,
)
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
# ---------------------------------------------------------------------------
diff --git a/tests/hermes_cli/test_dep_ensure.py b/tests/hermes_cli/test_dep_ensure.py
index 17b37d1f5d6..21afa8f1c79 100644
--- a/tests/hermes_cli/test_dep_ensure.py
+++ b/tests/hermes_cli/test_dep_ensure.py
@@ -3,11 +3,11 @@ from unittest.mock import patch
import pytest
def test_find_install_script_from_checkout(tmp_path):
"""_find_install_script finds scripts/install.sh in a git checkout.
- ``linux_only``: the POSIX arm picks ``install.sh`` + ``bash``, which is
+ ``platforms("linux")``: the POSIX arm picks ``install.sh`` + ``bash``, which is
already what ``_IS_WINDOWS`` reports here — nothing needs faking.
"""
from hermes_cli.dep_ensure import _find_install_script
@@ -98,9 +98,9 @@ def test_find_agent_browser_lazy_install_cycle_terminates(monkeypatch):
assert validate_calls == [True, False]
def test_ensure_dependency_uses_powershell_on_windows(tmp_path):
- """``windows_only``: the assertion is that we shell out to a real
+ """``platforms("windows")``: the assertion is that we shell out to a real
PowerShell. Faking ``_IS_WINDOWS`` on Linux also required faking
``shutil.which`` into inventing a powershell.exe that isn't there."""
from hermes_cli.dep_ensure import ensure_dependency
diff --git a/tests/hermes_cli/test_desktop_exe_integrity.py b/tests/hermes_cli/test_desktop_exe_integrity.py
index 6e9d3dd06e9..3644e49a681 100644
--- a/tests/hermes_cli/test_desktop_exe_integrity.py
+++ b/tests/hermes_cli/test_desktop_exe_integrity.py
@@ -138,13 +138,13 @@ def _fake_windll(
return _windll
def test_native_machine_reports_os_arch_not_process_arch():
"""The #69179 WoA regression: x64 Python under ARM64 emulation must report
ARM64 (the OS), not AMD64 (the process) — otherwise the integrity gate
rejects the correct ARM64 rebuild.
- ``windows_only``: the probe under test is a ``ctypes.WinDLL("kernel32")``
+ ``platforms("windows")``: the probe under test is a ``ctypes.WinDLL("kernel32")``
call to ``IsWow64Process2``. A patched ``sys.platform`` only got the branch
entered — there is no kernel32 to bind on Linux, so nothing below the
branch (the HANDLE typing that #71218 was about) was ever executed.
@@ -157,13 +157,13 @@ def test_native_machine_reports_os_arch_not_process_arch():
assert cli_main._windows_native_machine() == "ARM64"
def test_expected_machines_prefers_user_runnable_api_over_arch_name(monkeypatch):
"""GetMachineTypeAttributes answers "can this host load PE machine X?"
directly, so a WoA host that reports AMD64 everywhere else still accepts an
ARM64 exe.
- ``windows_only``: ``GetMachineTypeAttributes`` is a real kernel32 export
+ ``platforms("windows")``: ``GetMachineTypeAttributes`` is a real kernel32 export
the fake host could not provide.
"""
import ctypes
@@ -235,9 +235,9 @@ def test_rollback_restores_backup_and_keeps_corrupt_copy(tmp_path):
def test_gate_fails_clearly_without_backup(tmp_path, capsys):
- """``windows_only``: ``_ensure_desktop_exe_launchable`` is a documented
+ """``platforms("windows")``: ``_ensure_desktop_exe_launchable`` is a documented
no-op off Windows, so the fake was the only reason the gate ran at all.
"""
desktop_dir, exe = _win_tree(tmp_path)
@@ -274,13 +274,13 @@ def _ns(**kw):
return argparse.Namespace(**defaults)
def test_build_only_fails_when_pack_produces_corrupt_exe(tmp_path, monkeypatch, capsys):
"""The updater chain's contract: a rebuild whose Hermes.exe cannot launch
must exit nonzero (so hermes-setup's retry-once kicks in) and must restore
the previous working build instead of leaving the corrupt one.
- ``windows_only``: the whole chain is Windows-gated — ``win-unpacked``
+ ``platforms("windows")``: the whole chain is Windows-gated — ``win-unpacked``
candidate discovery in ``_desktop_packaged_executable`` and the integrity
gate itself both short-circuit off Windows.
"""
diff --git a/tests/hermes_cli/test_doctor_journal_modes.py b/tests/hermes_cli/test_doctor_journal_modes.py
index 15c32bf471e..e8f7773201d 100644
--- a/tests/hermes_cli/test_doctor_journal_modes.py
+++ b/tests/hermes_cli/test_doctor_journal_modes.py
@@ -277,7 +277,7 @@ class TestLiveConnectionSafety:
class TestUnreadableReason:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_missing_file_keeps_the_os_error_text(self, tmp_path):
reason = doctor._unreadable_reason(tmp_path / "gone.db")
diff --git a/tests/hermes_cli/test_ensure_hermes_home_uid_34107.py b/tests/hermes_cli/test_ensure_hermes_home_uid_34107.py
index 367bf39bc99..0937768ee1c 100644
--- a/tests/hermes_cli/test_ensure_hermes_home_uid_34107.py
+++ b/tests/hermes_cli/test_ensure_hermes_home_uid_34107.py
@@ -27,7 +27,7 @@ import pytest
class TestResolveHermesUidGid:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_returns_parsed_values_when_both_set(self, monkeypatch):
monkeypatch.setenv("HERMES_UID", "1000")
monkeypatch.setenv("HERMES_GID", "911")
@@ -37,11 +37,11 @@ class TestResolveHermesUidGid:
assert gid == 911
- # ``windows_only`` rather than ``skipif(sys.platform != "win32")``: the
- # Windows CI job selects ``-m windows_only``, so a bare skipif would leave
+ # ``platforms("windows")`` rather than ``skipif(sys.platform != "win32")``: the
+ # Windows CI job selects ``-m platforms("windows")``, so a bare skipif would leave
# this test skipped on Linux AND unselected on the Windows lane — dead on
# every host.
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_returns_none_none(self, monkeypatch):
monkeypatch.setenv("HERMES_UID", "1000")
monkeypatch.setenv("HERMES_GID", "911")
@@ -56,7 +56,7 @@ class TestResolveHermesUidGid:
# ---------------------------------------------------------------------------
class TestChownToHermesUid:
def test_calls_os_chown_when_both_set(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_UID", "1000")
diff --git a/tests/hermes_cli/test_gateway.py b/tests/hermes_cli/test_gateway.py
index 5defbb01cd4..0425b2ba4d9 100644
--- a/tests/hermes_cli/test_gateway.py
+++ b/tests/hermes_cli/test_gateway.py
@@ -130,7 +130,7 @@ def _run_native_windows_gateway_start_diag(
return json.loads(line.removeprefix("DIAG_JSON="))
@pytest.mark.parametrize(
("marker", "expected_breakaway"),
[("1", True), ("0", False), (None, None)],
diff --git a/tests/hermes_cli/test_gateway_foreign_xdg_runtime.py b/tests/hermes_cli/test_gateway_foreign_xdg_runtime.py
index e7c2c71cf91..d5356e2ea9f 100644
--- a/tests/hermes_cli/test_gateway_foreign_xdg_runtime.py
+++ b/tests/hermes_cli/test_gateway_foreign_xdg_runtime.py
@@ -16,7 +16,7 @@ import pytest
import hermes_cli.gateway as gateway_cli
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
def _eacces(self):
diff --git a/tests/hermes_cli/test_gateway_linger.py b/tests/hermes_cli/test_gateway_linger.py
index 44b653298c4..0a27048b058 100644
--- a/tests/hermes_cli/test_gateway_linger.py
+++ b/tests/hermes_cli/test_gateway_linger.py
@@ -6,7 +6,7 @@ import pytest
import hermes_cli.gateway as gateway
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
class TestEnsureLingerEnabled:
diff --git a/tests/hermes_cli/test_gateway_platform_gating.py b/tests/hermes_cli/test_gateway_platform_gating.py
index e1c4dabe256..e0ff6aa9bf8 100644
--- a/tests/hermes_cli/test_gateway_platform_gating.py
+++ b/tests/hermes_cli/test_gateway_platform_gating.py
@@ -16,7 +16,7 @@ import pytest
class TestMatrixHiddenOnWindows:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_matrix_present_on_linux(self):
"""Sanity: matrix is still in the picker on Linux.
@@ -29,7 +29,7 @@ class TestMatrixHiddenOnWindows:
keys = {p["key"] for p in platforms}
assert "matrix" in keys, "matrix must be available on Linux"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_matrix_absent_on_windows(self):
"""The gate itself: matrix must be dropped on a real Windows host.
@@ -43,7 +43,7 @@ class TestMatrixHiddenOnWindows:
keys = {p["key"] for p in platforms}
assert "matrix" not in keys, "matrix must be hidden on Windows"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_other_platforms_unaffected_on_windows(self):
"""Gating must only drop matrix, not collateral damage."""
import hermes_cli.gateway as gateway_mod
diff --git a/tests/hermes_cli/test_gateway_proc_fallback.py b/tests/hermes_cli/test_gateway_proc_fallback.py
index a8aa531ada0..f9c2cf99829 100644
--- a/tests/hermes_cli/test_gateway_proc_fallback.py
+++ b/tests/hermes_cli/test_gateway_proc_fallback.py
@@ -13,7 +13,7 @@ import pytest
import hermes_cli.gateway as gateway_mod
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
# ---------------------------------------------------------------------------
@@ -55,7 +55,7 @@ def _fake_proc_dir(entries: dict):
# ---------------------------------------------------------------------------
class TestProcFallback:
"""_scan_gateway_pids reads /proc when available, skips ps.
diff --git a/tests/hermes_cli/test_gateway_restart_loop.py b/tests/hermes_cli/test_gateway_restart_loop.py
index ff27703a193..65fc7994b85 100644
--- a/tests/hermes_cli/test_gateway_restart_loop.py
+++ b/tests/hermes_cli/test_gateway_restart_loop.py
@@ -556,7 +556,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 1
assert "Blocked" in result["error"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_blocks_lifecycle_command_hidden_in_referenced_script(
self, monkeypatch, tmp_path
):
@@ -666,7 +666,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 0
assert calls == ["hermes gateway restart"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_blocks_launchctl_submit_hidden_in_referenced_script(
self, monkeypatch, tmp_path
):
@@ -702,7 +702,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 1
assert "referenced script" in result["error"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_blocks_executable_shebang_script(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
@@ -726,7 +726,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 1
assert "KeepAlive" in result["error"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_shell_option_with_value_still_scans_script(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
@@ -760,7 +760,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 1
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_nested_wrapper_script_is_scanned(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
@@ -781,7 +781,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 1
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_non_regular_referenced_script_fails_closed(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
@@ -815,7 +815,7 @@ class TestTerminalToolGatewayLifecycleGuard:
assert result["exit_code"] == 0
assert calls == [command]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_safe_referenced_script_passes_through(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
@@ -868,7 +868,7 @@ class TestTerminalToolGatewayLifecycleGuard:
class TestLifecycleGuardModule:
"""Direct tests for cron.lifecycle_guard.check_gateway_lifecycle."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_dot_operator_sourced_script_is_scanned(self, tmp_path):
"""`. ./script.sh` must reach the referenced-script scan.
@@ -887,7 +887,7 @@ class TestLifecycleGuardModule:
is True
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_nul_padded_script_is_still_scanned(self, tmp_path):
"""A NUL byte in a *text* script must not disable the scan.
@@ -906,7 +906,7 @@ class TestLifecycleGuardModule:
is True
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_source_builtin_sourced_script_is_scanned(self, tmp_path):
"""The `source` spelling must stay blocked (it already was)."""
from cron.lifecycle_guard import (
@@ -932,7 +932,7 @@ class TestLifecycleGuardModule:
is False
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_nul_padded_script_without_shebang_is_scanned(self, tmp_path):
"""Same bypass without a shebang — bash still runs it, so still scan.
@@ -983,7 +983,7 @@ class TestLifecycleGuardModule:
is False
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_oversized_nul_bearing_text_still_fails_closed(self, tmp_path):
"""An oversized *text* script must keep failing closed.
@@ -1248,7 +1248,7 @@ class TestLifecycleGuardModule:
str(launcher)
) is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_third_party_cloudstorage_path_fails_closed_without_opening(
self, tmp_path, monkeypatch
):
@@ -1478,7 +1478,7 @@ class TestLifecycleGuardModule:
# Defense 2 (chokepoint): cron.jobs.create_job blocks the AGENT model-tool path
# ---------------------------------------------------------------------------
class TestDotSourceIsScannedLikeSource:
"""`.` and `source` are the same POSIX builtin and must scan alike.
@@ -1537,7 +1537,7 @@ class TestDotSourceIsScannedLikeSource:
assert self._scan(f". {clean}", cwd=str(tmp_path)) is False
class TestTransparentWrapperPrefixes:
"""`sudo`/`env`/`nohup`/... exec their argument tail, so the command that
actually runs sits further right. Reading only the first token made the
@@ -1857,7 +1857,7 @@ class TestTerminalToolGatewayLifecycleGuardRemote:
lambda: inside_gateway,
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_remote_backend_script_read_uses_env_execute(self, monkeypatch, tmp_path):
import tools.terminal_tool as tt
diff --git a/tests/hermes_cli/test_gateway_service.py b/tests/hermes_cli/test_gateway_service.py
index b3464258479..a2572f62f3a 100644
--- a/tests/hermes_cli/test_gateway_service.py
+++ b/tests/hermes_cli/test_gateway_service.py
@@ -346,7 +346,7 @@ class TestGeneratedSystemdUnits:
class TestGatewayStopCleanup:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_stop_only_kills_current_profile_by_default(self, tmp_path, monkeypatch):
"""Without --all, stop uses systemd (if available) and does NOT call
the global kill_gateway_processes().
@@ -1120,7 +1120,7 @@ class TestGatewaySystemServiceRouting:
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_gateway_restart_does_not_fallback_to_foreground_when_launchd_restart_fails(self, tmp_path, monkeypatch):
"""macOS-gated: the branch under test is ``elif is_macos() and
get_launchd_plist_path().exists()``. Faking the platform flags on Linux
diff --git a/tests/hermes_cli/test_gateway_windows.py b/tests/hermes_cli/test_gateway_windows.py
index 9580964a93f..c0c79a5622c 100644
--- a/tests/hermes_cli/test_gateway_windows.py
+++ b/tests/hermes_cli/test_gateway_windows.py
@@ -32,7 +32,7 @@ def test_schtasks_encoding_falls_back_to_utf8(monkeypatch):
def test_build_gateway_argv_keeps_venv_console_python_for_uv_venv(monkeypatch, tmp_path):
"""No pythonw / base-interpreter detour: the venv console python.exe is
launched hidden (CREATE_NO_WINDOW) so descendants inherit its hidden
@@ -79,7 +79,7 @@ def test_build_gateway_argv_keeps_venv_console_python_for_uv_venv(monkeypatch, t
assert str(project) in env_overlay["PYTHONPATH"].split(gateway_windows.os.pathsep)
def test_spawn_detached_marks_primary_breakaway_success(monkeypatch, tmp_path, caplog):
"""A successful breakaway spawn reports true without a warning."""
argv = ["python.exe", "-m", "hermes_cli.main", "gateway", "run"]
@@ -111,7 +111,7 @@ def test_spawn_detached_marks_primary_breakaway_success(monkeypatch, tmp_path, c
assert not caplog.records
def test_spawn_detached_warns_and_marks_no_breakaway_fallback(
monkeypatch, tmp_path, caplog
):
@@ -230,7 +230,7 @@ def _arrange_startup_fallback(monkeypatch, tmp_path, running_pids):
def test_elevated_gateway_command_uses_hidden_console_python(monkeypatch):
"""UAC handoff launches console python with SW_HIDE — a single hidden
console, not console-less pythonw (#54220/#56747), and no visible
diff --git a/tests/hermes_cli/test_gateway_wsl.py b/tests/hermes_cli/test_gateway_wsl.py
index 6e7ff379327..5f677d196b0 100644
--- a/tests/hermes_cli/test_gateway_wsl.py
+++ b/tests/hermes_cli/test_gateway_wsl.py
@@ -59,7 +59,7 @@ class TestWslSystemdOperational:
class TestSupportsSystemdServicesWSL:
"""Test that supports_systemd_services() handles WSL correctly."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_wsl_with_systemd(self, monkeypatch):
"""WSL + working systemd → True.
@@ -74,7 +74,7 @@ class TestSupportsSystemdServicesWSL:
monkeypatch.setattr(gateway, "_wsl_systemd_operational", lambda: True)
assert gateway.supports_systemd_services() is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_termux_still_excluded(self, monkeypatch):
"""Termux → False regardless of WSL status.
@@ -92,7 +92,7 @@ class TestSupportsSystemdServicesWSL:
class TestGatewayCommandWSLMessages:
"""Test that WSL users see appropriate guidance."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_install_wsl_no_systemd(self, monkeypatch, capsys):
"""hermes gateway install on WSL without systemd shows guidance.
@@ -122,7 +122,7 @@ class TestGatewayCommandWSLMessages:
assert "tmux" in out
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_status_wsl_running_manual(self, monkeypatch, capsys):
"""hermes gateway status on WSL with manual process shows WSL note.
diff --git a/tests/hermes_cli/test_goal_gates.py b/tests/hermes_cli/test_goal_gates.py
index f139de9e74d..7be845ab546 100644
--- a/tests/hermes_cli/test_goal_gates.py
+++ b/tests/hermes_cli/test_goal_gates.py
@@ -64,7 +64,7 @@ def test_run_gate_pass():
assert "hello" in out
def test_run_gate_fail_captures_output():
# POSIX shell syntax (`>&2`, `;`, `exit`) — cmd.exe (shell=True on Windows)
# doesn't parse it, so the gate "passes" instead of failing.
diff --git a/tests/hermes_cli/test_graphical_browser_detection.py b/tests/hermes_cli/test_graphical_browser_detection.py
index a7c461a88ac..ca250b5f270 100644
--- a/tests/hermes_cli/test_graphical_browser_detection.py
+++ b/tests/hermes_cli/test_graphical_browser_detection.py
@@ -40,7 +40,7 @@ def _force_resolved_browser(monkeypatch, name: str):
monkeypatch.setattr(webbrowser, "get", lambda *_a, **_kw: _FakeController(name))
def test_headless_linux_no_display_refuses(monkeypatch):
"""The reported bug: headless Linux, no display server → don't auto-open.
diff --git a/tests/hermes_cli/test_gui_command.py b/tests/hermes_cli/test_gui_command.py
index b5cef350212..0649f36d2c7 100644
--- a/tests/hermes_cli/test_gui_command.py
+++ b/tests/hermes_cli/test_gui_command.py
@@ -99,7 +99,7 @@ def _make_packaged_executable(root: Path, monkeypatch) -> Path:
return exe
def test_gui_installs_packages_and_launches_desktop_app(tmp_path, monkeypatch):
# Exercises the npm-pack → packaged-exe launch path; Windows desktop is
# MSIX-only (Electron autoUpdater) and takes a different launch route.
@@ -311,7 +311,7 @@ def test_electron_dist_ok_on_this_host():
assert cli_main._electron_dist_ok(root) is True
def test_electron_dist_binary_basename_linux():
"""``dist/electron`` on Linux — asserted against the live function.
@@ -327,7 +327,7 @@ def test_electron_dist_binary_basename_linux():
)
def test_electron_dist_binary_basename_windows():
"""``dist/electron.exe`` on Windows — the ``.exe`` suffix is the whole point."""
root = Path("C:/does-not-need-to-exist")
@@ -336,7 +336,7 @@ def test_electron_dist_binary_basename_windows():
)
def test_electron_dist_binary_basename_macos():
"""``dist/Electron.app/Contents/MacOS/Electron`` on macOS.
@@ -457,7 +457,7 @@ def test_desktop_macos_local_codesign_signs_native_binaries(tmp_path, monkeypatc
def test_relaunchable_fixup_falls_back_to_legacy_adhoc_on_failure(tmp_path, monkeypatch, capsys):
"""A failing stable sign must still leave a launchable (deep ad-hoc) bundle.
@@ -465,7 +465,7 @@ def test_relaunchable_fixup_falls_back_to_legacy_adhoc_on_failure(tmp_path, monk
with the fallback sign and strict verification succeeding, the fixup
reports ``True`` per its documented contract.
- ``macos_only``: the subject is ``codesign`` against a real ``.app`` bundle
+ ``platforms("macos")``: the subject is ``codesign`` against a real ``.app`` bundle
layout (``exe.parents[2]``), which only the macOS packaged tree produces.
"""
root = _make_desktop_tree(tmp_path)
@@ -750,7 +750,7 @@ def test_cmd_gui_setup_tcc_identity_exits_before_build(tmp_path, monkeypatch):
def test_relaunchable_fixup_stable_identity_never_touches_keychain(tmp_path, monkeypatch):
"""A successful stable-identity re-sign must NOT delete the safeStorage item.
@@ -761,7 +761,7 @@ def test_relaunchable_fixup_stable_identity_never_touches_keychain(tmp_path, mon
so after the first launch the keychain ACL already matches and deleting
the item would destroy working credentials on every update.
- ``macos_only``: the fixup no-ops on non-macOS (sys.platform guard), and
+ ``platforms("macos")``: the fixup no-ops on non-macOS (sys.platform guard), and
the subject is codesign against a real ``.app`` bundle layout.
"""
root = _make_desktop_tree(tmp_path)
@@ -787,7 +787,7 @@ def test_relaunchable_fixup_stable_identity_never_touches_keychain(tmp_path, mon
assert not any("delete-generic-password" in c for c in calls)
def test_relaunchable_fixup_default_noconfig_success_never_touches_keychain(tmp_path, monkeypatch):
"""Default no-config path (identity == '-') must not delete the keychain item.
@@ -795,7 +795,7 @@ def test_relaunchable_fixup_default_noconfig_success_never_touches_keychain(tmp_
``desktop.macos_signing_identity`` configured, the fixup signs ad-hoc with
identifier-pinned requirements and must leave the safeStorage item alone.
- ``macos_only``: the fixup no-ops on non-macOS (sys.platform guard), and
+ ``platforms("macos")``: the fixup no-ops on non-macOS (sys.platform guard), and
the subject is codesign against a real ``.app`` bundle layout.
"""
root = _make_desktop_tree(tmp_path)
@@ -819,7 +819,7 @@ def test_relaunchable_fixup_default_noconfig_success_never_touches_keychain(tmp_
assert not any("delete-generic-password" in c for c in calls)
def test_relaunchable_fixup_legacy_adhoc_failure_never_touches_keychain(tmp_path, monkeypatch):
"""A failed fallback re-sign must preserve the keychain item (no deletion).
@@ -830,7 +830,7 @@ def test_relaunchable_fixup_legacy_adhoc_failure_never_touches_keychain(tmp_path
successor app/key identity. The fixup must check the codesign result,
run strict verification, and leave the keychain untouched on failure.
- ``macos_only``: the fixup no-ops on non-macOS (sys.platform guard), and
+ ``platforms("macos")``: the fixup no-ops on non-macOS (sys.platform guard), and
the subject is codesign against a real ``.app`` bundle layout.
"""
root = _make_desktop_tree(tmp_path)
@@ -869,7 +869,7 @@ def test_relaunchable_fixup_legacy_adhoc_failure_never_touches_keychain(tmp_path
assert not any("delete-generic-password" in c for c in calls)
def test_relaunchable_fixup_legacy_adhoc_success_still_verifies_and_never_deletes(tmp_path, monkeypatch):
"""A successful fallback re-sign runs strict verification, no deletion.
@@ -879,7 +879,7 @@ def test_relaunchable_fixup_legacy_adhoc_success_still_verifies_and_never_delete
("Always Allow" updates the ACL partition list and preserves the key);
deletion is not.
- ``macos_only``: the fixup no-ops on non-macOS (sys.platform guard), and
+ ``platforms("macos")``: the fixup no-ops on non-macOS (sys.platform guard), and
the subject is codesign against a real ``.app`` bundle layout.
"""
root = _make_desktop_tree(tmp_path)
@@ -922,7 +922,7 @@ def test_relaunchable_fixup_legacy_adhoc_success_still_verifies_and_never_delete
# --- Linux launcher entry registration ------------------------------------
def test_gui_registers_linux_desktop_entry_before_launch(tmp_path, monkeypatch):
"""`hermes desktop` gives the app a launcher presence on Linux."""
root = _make_desktop_tree(tmp_path)
@@ -948,7 +948,7 @@ def test_gui_registers_linux_desktop_entry_before_launch(tmp_path, monkeypatch):
assert registered == [root]
def test_gui_launches_even_when_desktop_entry_install_fails(tmp_path, monkeypatch):
"""Launcher plumbing is a convenience — it must never block the app."""
root = _make_desktop_tree(tmp_path)
@@ -974,7 +974,7 @@ def test_gui_launches_even_when_desktop_entry_install_fails(tmp_path, monkeypatc
assert mock_run.call_args.args[0] == [str(packaged_exe)]
def test_gui_skips_desktop_entry_off_linux(tmp_path, monkeypatch):
root = _make_desktop_tree(tmp_path)
monkeypatch.setattr(cli_main, "PROJECT_ROOT", root)
@@ -1039,7 +1039,7 @@ def test_desktop_launch_options_ozone_hint_defaults_auto():
assert cli_main._desktop_launch_options()[3] == "auto"
def test_gui_bridges_ozone_hint_to_launch_env(tmp_path, monkeypatch):
"""COSMIC HUD: ``desktop.ozone_platform_hint: x11`` sets
``ELECTRON_OZONE_PLATFORM_HINT`` on the launched Electron process."""
@@ -1138,7 +1138,7 @@ def test_detect_linux_password_store_none_when_no_keychain(monkeypatch):
assert cli_main._detect_linux_password_store() is None
def test_gui_linux_packaged_launch_bridges_detected_password_store(tmp_path, monkeypatch):
_clear_keychain_env(monkeypatch)
root = _make_desktop_tree(tmp_path)
@@ -1164,7 +1164,7 @@ def test_gui_linux_packaged_launch_bridges_detected_password_store(tmp_path, mon
assert launch_env["HERMES_DESKTOP_PASSWORD_STORE"] == "gnome-libsecret"
def test_gui_linux_source_launch_bridges_detected_password_store(tmp_path, monkeypatch):
_clear_keychain_env(monkeypatch)
root = _make_desktop_tree(tmp_path)
@@ -1188,7 +1188,7 @@ def test_gui_linux_source_launch_bridges_detected_password_store(tmp_path, monke
assert launch_env["HERMES_DESKTOP_PASSWORD_STORE"] == "kwallet6"
def test_gui_config_password_store_skips_detection(tmp_path, monkeypatch):
_clear_keychain_env(monkeypatch)
root = _make_desktop_tree(tmp_path)
@@ -1216,7 +1216,7 @@ def test_gui_config_password_store_skips_detection(tmp_path, monkeypatch):
assert launch_env["HERMES_DESKTOP_PASSWORD_STORE"] == "kwallet6"
def test_gui_explicit_password_store_env_wins_over_config_and_detection(tmp_path, monkeypatch):
_clear_keychain_env(monkeypatch)
monkeypatch.setenv("HERMES_DESKTOP_PASSWORD_STORE", "basic")
@@ -1245,7 +1245,7 @@ def test_gui_explicit_password_store_env_wins_over_config_and_detection(tmp_path
assert launch_env["HERMES_DESKTOP_PASSWORD_STORE"] == "basic"
def test_gui_password_store_bridge_is_linux_only(tmp_path, monkeypatch):
_clear_keychain_env(monkeypatch)
root = _make_desktop_tree(tmp_path)
diff --git a/tests/hermes_cli/test_hooks_cli.py b/tests/hermes_cli/test_hooks_cli.py
index 11d8ebf6b4d..f6f1340255b 100644
--- a/tests/hermes_cli/test_hooks_cli.py
+++ b/tests/hermes_cli/test_hooks_cli.py
@@ -79,7 +79,7 @@ class TestHooksList:
# ── test ──────────────────────────────────────────────────────────────────
class TestHooksTest:
def test_synthetic_payload_matches_production_shape(self, tmp_path):
"""`hermes hooks test` must feed the script stdin in the same
diff --git a/tests/hermes_cli/test_install_cua_driver.py b/tests/hermes_cli/test_install_cua_driver.py
index e67195d7d3e..0b6eaf73297 100644
--- a/tests/hermes_cli/test_install_cua_driver.py
+++ b/tests/hermes_cli/test_install_cua_driver.py
@@ -144,7 +144,7 @@ class TestInstallCuaDriverUpgrade:
assert tools_config.install_cua_driver(upgrade=False) is False
warn.assert_called()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_upgrade_with_binary_present_runs_installer(self):
from hermes_cli import tools_config
@@ -164,7 +164,7 @@ class TestInstallCuaDriverUpgrade:
kwargs = runner.call_args.kwargs
assert kwargs.get("verbose") is False
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_upgrade_without_binary_runs_installer(self):
from hermes_cli import tools_config
@@ -175,9 +175,9 @@ class TestInstallCuaDriverUpgrade:
assert tools_config.install_cua_driver(upgrade=True) is True
runner.assert_called_once()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_quiet_refresh_prints_single_contextual_progress_line(self):
- """``linux_only``: reaches Popen through the POSIX download-then-exec
+ """``platforms("linux")``: reaches Popen through the POSIX download-then-exec
branch, which this lane takes for real."""
from unittest.mock import MagicMock
@@ -209,9 +209,9 @@ class TestInstallCuaDriverUpgrade:
"→ Refreshing cua-driver (Computer Use)..."
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_quiet_refresh_can_suppress_progress_line(self):
- """``linux_only``: same POSIX Popen path as the test above."""
+ """``platforms("linux")``: same POSIX Popen path as the test above."""
from unittest.mock import MagicMock
from hermes_cli import tools_config
@@ -281,7 +281,7 @@ class TestInstallCuaDriverUpgrade:
assert popen.call_args.kwargs["stdin"] is subprocess.DEVNULL
fake_proc.communicate.assert_called_once_with(timeout=120)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_upgrade_can_suppress_installer_progress(self):
from hermes_cli import tools_config
@@ -345,11 +345,11 @@ class TestInstallCuaDriverUpgrade:
for call in info.call_args_list
)
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_install_target_writability_is_probed_for_real_on_macos(self):
"""The ``_cua_install_target_writable`` seam the two tests above patch.
- ``macos_only``: ``/Applications`` is the only install target Hermes
+ ``platforms("macos")``: ``/Applications`` is the only install target Hermes
checks, and the probe short-circuits to True on every other platform —
so this is the one host where the real filesystem answer means
anything.
@@ -459,7 +459,7 @@ class TestInstallCuaDriverUpgrade:
runner.assert_not_called()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_non_upgrade_without_binary_runs_installer(self):
from hermes_cli import tools_config
@@ -563,7 +563,7 @@ class TestRequireConfirmedUpdate:
runner.assert_called_once()
assert runner.call_args.kwargs["installer_timeout"] == 120
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_incompatible_driver_defers_interactive_repair(self):
incompatible = {
"ready": False,
@@ -583,7 +583,7 @@ class TestRequireConfirmedUpdate:
for call in info.call_args_list
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_missing_binary_defers_interactive_install(self):
"""Driver enabled but never installed (or wiped by a failed install):
the automatic update must not launch install.ps1 either — this path
@@ -710,15 +710,15 @@ class TestUpdateCheckTimeoutDefaults:
cua_backend.cua_driver_update_check()
return captured.get("timeout")
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_default_is_generous(self):
- """``windows_only``: the 25s default exists because a real Windows
+ """``platforms("windows")``: the 25s default exists because a real Windows
first-spawn is delayed by Defender/SmartScreen scanning — a faked
platform asserted the constant, never the host it is chosen for.
"""
assert self._captured_timeout() == 25.0
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_default_unchanged(self):
# Unmarked: the POSIX default is what this (Linux) host already picks,
# so no platform faking is involved.
@@ -885,9 +885,9 @@ class TestPosixStaleInstallLockClear:
class TestWindowsStaleInstallLockClearDispatch:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_branch_uses_file_lock_probe(self):
- """``windows_only``: which lock protocol applies IS the host fact under
+ """``platforms("windows")``: which lock protocol applies IS the host fact under
test — on Linux the faked platform asserted the dispatch and skipped
the ``.install.lock.d`` directory that really exists here.
"""
@@ -901,10 +901,10 @@ class TestWindowsStaleInstallLockClearDispatch:
clear_windows.assert_called_once_with()
-# ``windows_only`` rather than ``skipif(sys.platform != "win32")``: the
-# dedicated Windows CI job selects ``-m windows_only``, so a bare skipif left
+# ``platforms("windows")`` rather than ``skipif(sys.platform != "win32")``: the
+# dedicated Windows CI job selects ``-m platforms("windows")``, so a bare skipif left
# these real-CreateFileW tests running on no host at all.
class TestWindowsStaleInstallLockClear:
def _make_lock(self, tmp_path):
import os
@@ -975,11 +975,11 @@ class TestInstallerTimeoutKillsProcessGroup:
The POSIX cases drop the old ``platform.system`` → "Linux" fake: this lane
IS Linux, so the branch is selected for real. The Windows cases are
- ``windows_only`` — the psutil tree-kill only runs when ``is_windows``, and
+ ``platforms("windows")`` — the psutil tree-kill only runs when ``is_windows``, and
on Linux the fake picked that branch on a host with no such process model.
"""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_timeout_kills_process_group_and_returns_false(self):
import signal
import subprocess
@@ -1026,7 +1026,7 @@ class TestInstallerTimeoutKillsProcessGroup:
# lock; our ceiling must give that window room to complete.
assert tools_config._CUA_INSTALLER_TIMEOUT > tools_config._CUA_LOCK_STALE_AFTER
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_installer_runs_in_new_session_on_posix(self):
from unittest.mock import MagicMock
from hermes_cli import tools_config
@@ -1050,7 +1050,7 @@ class TestInstallerTimeoutKillsProcessGroup:
assert captured.get("start_new_session") is True
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_timeout_kills_descendants_and_parent(self):
import subprocess
from unittest.mock import MagicMock
@@ -1087,7 +1087,7 @@ class TestInstallerTimeoutKillsProcessGroup:
== tools_config._CUA_INSTALLER_DRAIN_GRACE
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_tree_enumeration_failure_falls_back_to_direct_kill(self):
import psutil
import subprocess
@@ -1146,9 +1146,9 @@ class TestInstallerTimeoutDrainIsBounded:
< tools_config._CUA_INSTALLER_TIMEOUT / 10
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_post_kill_drain_passes_a_deadline(self):
- """``linux_only``: reaches the timeout handler through the real POSIX
+ """``platforms("linux")``: reaches the timeout handler through the real POSIX
``killpg`` branch, so the drain under test is the one this lane runs.
"""
import subprocess
@@ -1180,7 +1180,7 @@ class TestInstallerTimeoutDrainIsBounded:
)
assert drain_timeout == tools_config._CUA_INSTALLER_DRAIN_GRACE
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_verbose_path_drains_under_the_same_deadline(self):
"""The streaming install has the same handler and had the same hole.
@@ -1217,7 +1217,7 @@ class TestInstallerTimeoutDrainIsBounded:
)
assert drain_timeout == tools_config._CUA_INSTALLER_DRAIN_GRACE
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_unkillable_elevated_descendant_does_not_stall_the_drain(self):
"""The reported scenario, with the kill refused exactly where it is.
@@ -1263,7 +1263,7 @@ class TestInstallerTimeoutDrainIsBounded:
)
assert drain_timeout == tools_config._CUA_INSTALLER_DRAIN_GRACE
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_drain_that_times_out_still_surfaces_the_run_timeout(self):
"""A guardrail, not a regression test — it passes without the fix too.
@@ -1301,14 +1301,14 @@ class TestInstallerTimeoutDrainIsBounded:
assert "timed out after" in warned
class TestInstallerNoShell:
"""The POSIX installer path must not use shell=True or command
substitution: the script is downloaded to a mkstemp file and exec'd
as a plain argv list (salvage of #34974's intent, without the fixed
/tmp path TOCTOU that PR introduced).
- ``linux_only``: the download-then-exec argv IS the POSIX branch, and this
+ ``platforms("linux")``: the download-then-exec argv IS the POSIX branch, and this
lane already takes it — the old ``platform.system`` → "Linux" fake was
asserting a branch the host had already selected.
"""
@@ -1468,12 +1468,12 @@ class TestConfirmedVersionPinning:
assert runner.call_args.kwargs.get("pin_version") is None
class TestRunInstallerPinEnv:
"""_run_cua_driver_installer(pin_version=...) exports CUA_DRIVER_RS_VERSION
into the installer child env; unpinned runs leave it untouched.
- ``linux_only``: the helper reaches Popen through the POSIX
+ ``platforms("linux")``: the helper reaches Popen through the POSIX
download-then-exec branch, which this lane takes for real — no
``platform.system`` fake needed. The pin itself is host-agnostic
(``TestConfirmedVersionPinning`` covers the caller side unmarked).
@@ -1520,9 +1520,9 @@ class TestRunInstallerPinEnv:
class TestWindowsAutostartRepair:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_existing_task_skips_elevated_powershell_repair(self):
- """``windows_only``: ``_repair_cua_driver_autostart_windows`` returns
+ """``platforms("windows")``: ``_repair_cua_driver_autostart_windows`` returns
True unconditionally off Windows, so only the fake made the schtasks
probe run at all.
"""
@@ -1546,9 +1546,9 @@ class TestWindowsAutostartRepair:
]
which.assert_not_called()
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_installer_runs_autostart_repair_after_success(self):
- """``windows_only``: the PowerShell install argv and the autostart
+ """``platforms("windows")``: the PowerShell install argv and the autostart
repair hook are both inside the ``is_windows`` branch, so on Linux the
fake selected a branch whose `powershell` doesn't exist on PATH."""
from unittest.mock import MagicMock
@@ -1590,9 +1590,9 @@ class TestWindowsAutostartRepair:
verbose=False,
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_autostart_repair_quotes_username_space_path_via_file_path(self):
- """``windows_only``: same early return off Windows — the elevated
+ """``platforms("windows")``: same early return off Windows — the elevated
PowerShell command string is only built on a real Windows host.
"""
from hermes_cli import tools_config
diff --git a/tests/hermes_cli/test_kanban_core_functionality.py b/tests/hermes_cli/test_kanban_core_functionality.py
index 9428a79ff1f..7e219ee68c0 100644
--- a/tests/hermes_cli/test_kanban_core_functionality.py
+++ b/tests/hermes_cli/test_kanban_core_functionality.py
@@ -1320,7 +1320,7 @@ def _drive_nonzero_crash(conn, tid, fake_pid):
return _drive_worker_exit(conn, tid, fake_pid, 256)
def test_protocol_violation_budget_not_consumed_by_other_failures(kanban_home):
"""Mixed failure kinds must not consume the violation retry budget.
diff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.py
index 5c0638c3254..0b47a915281 100644
--- a/tests/hermes_cli/test_kanban_db.py
+++ b/tests/hermes_cli/test_kanban_db.py
@@ -49,7 +49,7 @@ def _init_git_repo(repo: Path) -> None:
def test_cross_process_init_lock_uses_windows_byte_range_lock(tmp_path, monkeypatch):
"""Windows must use a real (non-blocking) process lock, not a no-op open.
@@ -57,7 +57,7 @@ def test_cross_process_init_lock_uses_windows_byte_range_lock(tmp_path, monkeypa
wedged holder can never block connect() forever; a clean acquire takes the
lock once and releases it once.
- ``windows_only``: ``msvcrt`` does not exist off Windows, so faking
+ ``platforms("windows")``: ``msvcrt`` does not exist off Windows, so faking
``_IS_WINDOWS`` on Linux meant injecting a fake ``msvcrt`` module too —
the test then asserted against its own stub rather than the byte-range
locking API. Here the platform is real; only ``msvcrt.locking`` is
@@ -264,7 +264,7 @@ def _exited_status(code: int) -> int:
def test_rate_limit_exit_requeues_without_counting_failure(
kanban_home, monkeypatch,
):
diff --git a/tests/hermes_cli/test_macos_tcc_anchor.py b/tests/hermes_cli/test_macos_tcc_anchor.py
index b6b6bd654ba..3212f9ee14f 100644
--- a/tests/hermes_cli/test_macos_tcc_anchor.py
+++ b/tests/hermes_cli/test_macos_tcc_anchor.py
@@ -6,7 +6,7 @@ bricked real Macs two ways: dynamically-linked builds died in dyld because
and alias symlinks to the copied interpreter lost the venv prefix (#95541).
Linux tests use fake checkout/uv-store layouts with ``platform.system``
-monkeypatched. The real-interpreter E2E is ``macos_only`` so it runs on
+monkeypatched. The real-interpreter E2E is ``platforms("macos")`` so it runs on
the existing macOS CI job, not against one-byte fixtures.
"""
@@ -127,7 +127,7 @@ class TestUvStoreDetection:
assert not tcc._is_uv_macos_store(path)
class TestEnsureTccAnchor:
def test_noop_on_non_macos(self, tmp_path, monkeypatch):
_linux(monkeypatch)
@@ -368,7 +368,7 @@ class TestEnsureTccAnchor:
assert f"/{_RUNTIME_DIR_NAME}/python/" in tcc._STORE_ROOT_MARKERS
class TestBootGate:
"""Direct branch coverage for _passes_boot_gate.
@@ -455,7 +455,7 @@ class TestBootGate:
assert tcc._passes_boot_gate(tmp_path / "staged", venv)
class TestTccAnchorState:
def test_state_active_through_unpatched_home_symlink(self, tmp_path, monkeypatch):
# The managed-runtime layout symlinks cpython-3.11-macos-* →
@@ -526,7 +526,7 @@ class TestTccAnchorState:
assert status == "active"
class TestDoctorCheck:
def test_missing_warns_without_fix(self, monkeypatch, capsys):
monkeypatch.setattr(
@@ -572,13 +572,13 @@ class TestDoctorCheck:
assert "macOS TCC anchor check failed" in out
class TestAnchoredAliasesBootE2E:
"""Real-interpreter proof that the re-land stays bootable (#95596).
Copies the running interpreter's real base binary into a fake uv-store
layout (stdlib via a ``lib`` symlink) and actually executes every
- entry point after anchoring. ``macos_only`` so Linux CI cannot
+ entry point after anchoring. ``platforms("macos")`` so Linux CI cannot
greenwash this with a fixture.
"""
diff --git a/tests/hermes_cli/test_managed_uv.py b/tests/hermes_cli/test_managed_uv.py
index 7bbb7e12dbf..ccbf3a3596b 100644
--- a/tests/hermes_cli/test_managed_uv.py
+++ b/tests/hermes_cli/test_managed_uv.py
@@ -157,7 +157,7 @@ class TestMacOSManagedPythonSigning:
class TestResolveUv:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_existing_executable(self, tmp_path):
_make_executable(tmp_path / "bin" / "uv")
with patch("hermes_cli.managed_uv.get_hermes_home", return_value=tmp_path):
@@ -182,7 +182,7 @@ class TestResolveUv:
class TestEnsureUv:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_installs_if_missing(self, tmp_path):
with patch("hermes_cli.managed_uv.get_hermes_home", return_value=tmp_path), \
patch("hermes_cli.managed_uv.repair_vulnerable_runtime", return_value=_RRR("not-applicable")), \
@@ -197,7 +197,7 @@ class TestEnsureUv:
assert path == str(tmp_path / "bin" / "uv")
mock_install.assert_called_once()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_install_reports_runtime_repair_to_observer(self, tmp_path):
from hermes_cli.managed_uv import (
RuntimeRepairResult,
@@ -305,9 +305,9 @@ class TestEnsureUvWindowsSafe:
with pytest.raises(TypeError):
subprocess.list2cmdline([_UvResult("C:\\hermes\\uv.exe"), "pip"])
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_returns_plain_str_safe_for_subprocess(self, tmp_path):
- """``windows_only``: the subject is the real Windows opt-out branch and
+ """``platforms("windows")``: the subject is the real Windows opt-out branch and
``subprocess.list2cmdline`` — the faked ``platform.system`` only ever
proved the branch existed, not that the field crash was fixed on the
host that reported it."""
@@ -332,7 +332,7 @@ class TestUpdateManagedUv:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_fresh_stamp_skips_network_self_update_but_not_repair(self, tmp_path, monkeypatch):
"""A recent success stamp must skip `uv self update` entirely while the
vulnerable-runtime repair probe still runs (CVE repair is never gated)."""
@@ -359,7 +359,7 @@ class TestUpdateManagedUv:
mock_repair.assert_called_once_with(str(uv))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_stale_stamp_runs_self_update_and_refreshes_stamp(self, tmp_path):
import os as _os
import time as _time
@@ -679,7 +679,7 @@ class TestRuntimeCutover:
# ---------------------------------------------------------------------------
class TestInstallUvInternals:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_sets_uv_unmanaged_install(self, tmp_path):
target = tmp_path / "bin" / "uv"
with patch("hermes_cli.managed_uv._install_uv_posix") as mock_posix:
@@ -1264,7 +1264,7 @@ class TestDefaultLiveVenv:
(bin_dir / "python").write_text("py", encoding="utf-8")
return root
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_dot_venv_only_is_targeted(self, tmp_path):
from hermes_cli.managed_uv import _default_live_venv
diff --git a/tests/hermes_cli/test_nous_subscription.py b/tests/hermes_cli/test_nous_subscription.py
index f0cc91139aa..533b3ada35a 100644
--- a/tests/hermes_cli/test_nous_subscription.py
+++ b/tests/hermes_cli/test_nous_subscription.py
@@ -479,7 +479,7 @@ def test_has_agent_browser_import_failure_falls_back_to_path_check(monkeypatch):
assert ns._has_agent_browser() is True
def test_has_agent_browser_import_failure_falls_back_to_hermes_managed_node_path(
monkeypatch, tmp_path
):
diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.py
index bdabebd57b9..79b464bf1f6 100644
--- a/tests/hermes_cli/test_profiles.py
+++ b/tests/hermes_cli/test_profiles.py
@@ -115,7 +115,7 @@ class TestCreateProfile:
"""Tests for create_profile()."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_seeds_placeholder_env_file(self, profile_env):
"""Fresh profiles get their own .env (owner-only) so channel/env
writes are profile-scoped from day one instead of falling through
@@ -270,7 +270,7 @@ class TestBackfillProfileEnvs:
gives pre-#44792 profiles (created before .env seeding) their own
.env, copied from the default install so credentials don't break."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_copies_default_env_into_envless_profiles(self, profile_env):
import stat
tmp_path = profile_env
@@ -595,7 +595,7 @@ class TestAliasCollision:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_checks_bat_extension(self, profile_env):
wrapper_dir = profile_env / ".local" / "bin"
wrapper_dir.mkdir(parents=True, exist_ok=True)
@@ -624,7 +624,7 @@ class TestAliasCollision:
class TestWrapperScript:
"""Tests for create_wrapper_script() and remove_wrapper_script()."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_creates_sh_on_posix(self, profile_env, monkeypatch):
monkeypatch.setattr("hermes_cli.profiles.shutil.which", lambda name: "/opt/hermes/bin/hermes")
from hermes_cli.profiles import create_wrapper_script
@@ -636,7 +636,7 @@ class TestWrapperScript:
assert "exec /opt/hermes/bin/hermes -p mybot" in content
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_remove_finds_bat_on_windows(self, profile_env):
from hermes_cli.profiles import create_wrapper_script, remove_wrapper_script
wrapper = create_wrapper_script("mybot")
@@ -699,7 +699,7 @@ class TestFindAliasForProfile:
assert find_alias_for_profile("steve") is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_list_profiles_surfaces_custom_alias(self, profile_env):
from hermes_cli.profiles import (
create_profile,
diff --git a/tests/hermes_cli/test_prompt_compose_command.py b/tests/hermes_cli/test_prompt_compose_command.py
index aec7ace09d9..cd34337b1d3 100644
--- a/tests/hermes_cli/test_prompt_compose_command.py
+++ b/tests/hermes_cli/test_prompt_compose_command.py
@@ -46,7 +46,7 @@ def test_command_registered():
assert resolve_command("compose").name == "prompt"
def test_compose_reads_and_strips_header(monkeypatch):
monkeypatch.setenv("EDITOR", _fake_editor("Refactor the auth module.\nUse pytest."))
out = _Stub()._compose_in_editor("")
@@ -55,7 +55,7 @@ def test_compose_reads_and_strips_header(monkeypatch):
assert "#!" not in out # the instructional header is stripped
def test_empty_buffer_does_not_seed(monkeypatch):
monkeypatch.setenv("EDITOR", _fake_editor("", mode="clear"))
s = _Stub()
diff --git a/tests/hermes_cli/test_relaunch.py b/tests/hermes_cli/test_relaunch.py
index c964a7031e8..fbbc1a073a6 100644
--- a/tests/hermes_cli/test_relaunch.py
+++ b/tests/hermes_cli/test_relaunch.py
@@ -99,7 +99,7 @@ class TestBuildRelaunchArgv:
class TestRelaunch:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_calls_execvp(self, monkeypatch):
calls = []
@@ -115,14 +115,14 @@ class TestRelaunch:
assert calls == [("/usr/bin/hermes", ["/usr/bin/hermes", "--resume", "abc"])]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_uses_subprocess_not_execvp(self, monkeypatch):
"""On Windows, os.execvp raises OSError "Exec format error" when the
target is a .cmd shim or console-script wrapper (both common for
hermes). relaunch() must detect win32 and use subprocess.run +
sys.exit instead.
- ``windows_only``: the bug is that ``os.execvp`` cannot exec a Windows
+ ``platforms("windows")``: the bug is that ``os.execvp`` cannot exec a Windows
console-script shim. On Linux ``execvp`` works fine, so a patched
platform only re-asserted the branch we wrote, never the constraint
that motivated it.
@@ -130,7 +130,7 @@ class TestRelaunch:
monkeypatch.setattr(relaunch_mod, "resolve_hermes_bin", lambda: r"C:\Users\test\hermes.exe")
# Pin sys.argv: relaunch() preserves inherited flags from the LIVE
# argv, so under pytest it happily inherited the runner's own
- # "-m 'windows_only and not integration'" and the assertion below saw
+ # "-m 'platforms("windows") and not integration'" and the assertion below saw
# them in the child argv. Nothing to do with Windows — it only showed
# up here because this is the first lane that actually executes the
# test, and -m is how that lane selects it.
@@ -164,7 +164,7 @@ class TestRelaunch:
assert execvp_calls == []
assert captured_argv == [[r"C:\Users\test\hermes.exe", "chat"]]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_propagates_child_exit_code(self, monkeypatch):
"""A non-zero exit from the child should flow through to sys.exit."""
monkeypatch.setattr(relaunch_mod, "resolve_hermes_bin", lambda: r"C:\hermes.exe")
@@ -191,12 +191,12 @@ class TestResolveHermesBinWindowsPyGuard:
subprocess.run can't actually exec a .py directly, so the relaunch
would fail with the cryptic "%1 is not a valid Win32 application" error.
- The Windows cases are ``windows_only``: the PATHEXT-driven ``os.access``
+ The Windows cases are ``platforms("windows")``: the PATHEXT-driven ``os.access``
result the guard defends against simply does not occur on POSIX, so a
faked ``sys.platform`` could never reproduce the hazard.
"""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_rejects_py_argv0_falls_through_to_path(self, monkeypatch, tmp_path):
"""On Windows, if sys.argv[0] is a .py file, we must skip the
argv[0] fast-path and fall through to PATH / python -m."""
@@ -216,7 +216,7 @@ class TestResolveHermesBinWindowsPyGuard:
# Must NOT be the .py — must be the hermes.exe PATH entry.
assert bin_path == r"C:\venv\Scripts\hermes.exe"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_still_accepts_py_argv0(self, monkeypatch, tmp_path):
"""POSIX behaviour unchanged: argv[0] pointing at an executable
script (including .py with a shebang + chmod +x) is fine to return
@@ -227,7 +227,7 @@ class TestResolveHermesBinWindowsPyGuard:
monkeypatch.setattr(relaunch_mod.sys, "argv", [str(script), "chat"])
assert relaunch_mod.resolve_hermes_bin() == str(script)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_py_argv0_with_no_hermes_on_path_returns_none(self, monkeypatch, tmp_path):
"""Bulletproof fallback: if argv0 is .py on Windows AND hermes.exe
isn't on PATH, return None so the caller falls back to
diff --git a/tests/hermes_cli/test_resume_latest_and_in_dir.py b/tests/hermes_cli/test_resume_latest_and_in_dir.py
index 8339b6fba05..d537ad63eb1 100644
--- a/tests/hermes_cli/test_resume_latest_and_in_dir.py
+++ b/tests/hermes_cli/test_resume_latest_and_in_dir.py
@@ -215,7 +215,7 @@ def test_in_dir_missing_directory_exits(main_mod, monkeypatch, tmp_path, capsys)
assert "--in directory not found" in capsys.readouterr().out
def test_in_dir_expands_user_home(main_mod, launched, monkeypatch, tmp_path):
import os
diff --git a/tests/hermes_cli/test_service_manager.py b/tests/hermes_cli/test_service_manager.py
index 807304c010d..22f99ffb615 100644
--- a/tests/hermes_cli/test_service_manager.py
+++ b/tests/hermes_cli/test_service_manager.py
@@ -192,7 +192,7 @@ def fake_subprocess_run(monkeypatch: pytest.MonkeyPatch):
# tests/docker/test_s6_profile_gateway_integration.py.
def test_seed_supervise_skeleton_creates_expected_layout(tmp_path) -> None:
"""Verifies the dirs + FIFO the helper lays down."""
import stat
@@ -226,7 +226,7 @@ def test_seed_supervise_skeleton_creates_expected_layout(tmp_path) -> None:
assert stat.S_IMODE(control.stat().st_mode) == 0o660
def test_seed_supervise_skeleton_sets_setgid_on_event_dirs(tmp_path) -> None:
"""The event dirs carry setgid so s6-supervise's EEXIST path leaves them alone.
@@ -372,7 +372,7 @@ def _log_run_setup_fragment(rendered: str) -> str:
return "#!/bin/sh\n" + "".join(keep)
def test_s6_log_run_creates_leaf_as_hermes_without_chown(
s6_scandir, fake_subprocess_run,
) -> None:
diff --git a/tests/hermes_cli/test_session_browse.py b/tests/hermes_cli/test_session_browse.py
index a3f9619e77a..dd2cc6f733c 100644
--- a/tests/hermes_cli/test_session_browse.py
+++ b/tests/hermes_cli/test_session_browse.py
@@ -97,7 +97,7 @@ class TestSessionBrowsePicker:
# ─── Curses-based picker (mocked curses) ────────────────────────────────────
class TestCursesBrowse:
"""Tests for the curses-based interactive picker via simulated key sequences."""
diff --git a/tests/hermes_cli/test_ssh_ownership_endpoint.py b/tests/hermes_cli/test_ssh_ownership_endpoint.py
index 6dd0eec32e0..a56d7f1937f 100644
--- a/tests/hermes_cli/test_ssh_ownership_endpoint.py
+++ b/tests/hermes_cli/test_ssh_ownership_endpoint.py
@@ -112,7 +112,7 @@ def test_ssh_runtime_marker_survives_in_place_installs(tmp_path, monkeypatch):
web_server._apply_ssh_owner_nonce(None)
def test_ssh_runtime_readonly_purelib_falls_back_to_stat(tmp_path, monkeypatch):
"""When site-packages is unwritable the marker can't be placed; the
stat-snapshot fallback still arms (weaker, never a false stale)."""
diff --git a/tests/hermes_cli/test_ssh_session_token_parser.py b/tests/hermes_cli/test_ssh_session_token_parser.py
index 429fe057959..fcc6c529ea0 100644
--- a/tests/hermes_cli/test_ssh_session_token_parser.py
+++ b/tests/hermes_cli/test_ssh_session_token_parser.py
@@ -123,7 +123,7 @@ def test_token_file_rejects_symlink(tmp_path, monkeypatch):
reset_hermes_home_override(override)
def test_token_file_rejects_parent_escape(tmp_path, monkeypatch):
home = tmp_path / "home"
monkeypatch.setenv("HOME", str(home))
diff --git a/tests/hermes_cli/test_terminal_breadcrumbs.py b/tests/hermes_cli/test_terminal_breadcrumbs.py
index 14432948e94..da2b641a449 100644
--- a/tests/hermes_cli/test_terminal_breadcrumbs.py
+++ b/tests/hermes_cli/test_terminal_breadcrumbs.py
@@ -16,7 +16,7 @@ import pytest
from hermes_cli import terminal_breadcrumbs as tb
-pytestmark = pytest.mark.linux_only # os.ttyname is POSIX-only
+pytestmark = pytest.mark.platforms("linux") # os.ttyname is POSIX-only
TERMINAL_ENV_VARS = (
diff --git a/tests/hermes_cli/test_update_gateway_launcher_refresh.py b/tests/hermes_cli/test_update_gateway_launcher_refresh.py
index be92a79a3d3..2257838a658 100644
--- a/tests/hermes_cli/test_update_gateway_launcher_refresh.py
+++ b/tests/hermes_cli/test_update_gateway_launcher_refresh.py
@@ -14,7 +14,7 @@ forever" gap:
``_resolve_detached_python`` is a pure path helper and runs on any host.
``windowless_gateway_restart_spec`` returns its argv unchanged off Windows,
-so the test that exercises the rewrite is ``windows_only`` rather than run
+so the test that exercises the rewrite is ``platforms("windows")`` rather than run
against a faked ``sys.platform``.
"""
@@ -57,13 +57,13 @@ def test_resolve_detached_python_swaps_legacy_pythonw_for_console_sibling(tmp_pa
def test_restart_spec_normalizes_legacy_pythonw_argv(tmp_path):
"""A pre-rework Scheduled Task argv snapshot (leading pythonw.exe) must be
respawned through the console python + hidden-console launch, with every
argument after the interpreter preserved verbatim.
- ``windows_only``: ``windowless_gateway_restart_spec`` returns the argv
+ ``platforms("windows")``: ``windowless_gateway_restart_spec`` returns the argv
untouched off Windows, so the fake was the only thing making the rewrite
(and its ``Scripts/``-layout venv derivation) run at all.
"""
diff --git a/tests/hermes_cli/test_update_launchd_unloaded_gateway.py b/tests/hermes_cli/test_update_launchd_unloaded_gateway.py
index 562c0882dde..938e679f349 100644
--- a/tests/hermes_cli/test_update_launchd_unloaded_gateway.py
+++ b/tests/hermes_cli/test_update_launchd_unloaded_gateway.py
@@ -133,7 +133,7 @@ ai.hermes.gateway = {
"""
class TestServicePidSweepExclusion:
"""Regression for the PR #75021 review: `_get_service_pids()` must not
rely on `launchctl list` alone.
diff --git a/tests/hermes_cli/test_update_stale_dashboard.py b/tests/hermes_cli/test_update_stale_dashboard.py
index cf3a199dc4b..44341edd6d3 100644
--- a/tests/hermes_cli/test_update_stale_dashboard.py
+++ b/tests/hermes_cli/test_update_stale_dashboard.py
@@ -175,11 +175,11 @@ class TestFindStaleDashboardPids:
with patch("subprocess.run", side_effect=sp.TimeoutExpired("ps", 10)):
assert _find_stale_dashboard_pids() == []
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_ps_timeout_returns_empty_linux(self):
self._assert_ps_timeout_returns_empty()
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_ps_timeout_returns_empty_macos(self):
self._assert_ps_timeout_returns_empty()
@@ -268,9 +268,9 @@ class TestKillStaleDashboardPosix:
class TestKillStaleDashboardWindows:
"""Kill path on Windows: taskkill /F."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_taskkill_invoked_for_each_pid(self, capsys):
- """``windows_only``: ``taskkill.exe`` only exists on Windows, and the
+ """``platforms("windows")``: ``taskkill.exe`` only exists on Windows, and the
faked platform also silently skipped the POSIX-only cgroup/argv
snapshot the real Windows path must not take.
"""
@@ -838,9 +838,9 @@ class TestCmdlineCapture:
assert argv == ["hermes", "serve", "--port", "8300"]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_returns_none_on_windows(self):
- """``windows_only``: the contract is "no graceful-argv capture on a
+ """``platforms("windows")``: the contract is "no graceful-argv capture on a
real Windows host" — asserting it against a faked platform only
restated the branch condition.
"""
diff --git a/tests/hermes_cli/test_update_wedged_gateway.py b/tests/hermes_cli/test_update_wedged_gateway.py
index 7f7c0a6d2cb..a2e1bf77c21 100644
--- a/tests/hermes_cli/test_update_wedged_gateway.py
+++ b/tests/hermes_cli/test_update_wedged_gateway.py
@@ -473,7 +473,7 @@ class TestLaunchdRestartWedgedIntegration:
assert ("drain", 4242, 195.0) in events
class TestLoopTickWitness:
"""Two-witness liveness (#90502 review).
diff --git a/tests/hermes_cli/test_verify_core_dependencies.py b/tests/hermes_cli/test_verify_core_dependencies.py
index 0404d2bb0e6..1c8362584e4 100644
--- a/tests/hermes_cli/test_verify_core_dependencies.py
+++ b/tests/hermes_cli/test_verify_core_dependencies.py
@@ -70,7 +70,7 @@ class TestVerifyCoreDependencies:
verification step would false-positive on every cross-platform
exclusion and chase its tail installing something inapplicable here.
- Deliberately host-invariant rather than ``windows_only``: the subject
+ Deliberately host-invariant rather than ``platforms("windows")``: the subject
is ``packaging``'s marker *evaluation*, not any OS facility. The
pyproject fixture declares one dep gated to non-Windows and one gated
to Windows, so exactly one of the pair is filtered on any host — the
diff --git a/tests/hermes_cli/test_web_ui_build.py b/tests/hermes_cli/test_web_ui_build.py
index 9b1b905c8b6..073e6b2d8d6 100644
--- a/tests/hermes_cli/test_web_ui_build.py
+++ b/tests/hermes_cli/test_web_ui_build.py
@@ -282,7 +282,7 @@ class TestBuildWebUIRetryAndStaleFallback:
assert "vite ENOMEM" in out # combined output surfaced to user
class TestBuildWebUIFlock:
"""Cross-process build serialization (salvaged from PR #63455).
diff --git a/tests/hermes_cli/test_win_pty_bridge.py b/tests/hermes_cli/test_win_pty_bridge.py
index fff0da000d4..87e6a222ab2 100644
--- a/tests/hermes_cli/test_win_pty_bridge.py
+++ b/tests/hermes_cli/test_win_pty_bridge.py
@@ -25,9 +25,9 @@ import pytest
# must never raise, otherwise the web_server import branch becomes a trap.
from hermes_cli.win_pty_bridge import PtyUnavailableError, WinPtyBridge
-# ``pytest.mark.windows_only`` rather than a local ``skipif`` alias: the
+# ``pytest.mark.platforms("windows")`` rather than a local ``skipif`` alias: the
# dedicated Windows CI job selects its files by grepping for the marker name
-# and then filters with ``-m windows_only``. A file-local skipif alias matched
+# and then filters with ``-m platforms("windows")``. A file-local skipif alias matched
# the grep (so the file was listed) but carried no marker, so every test below
# was deselected — the lane looked like it covered ConPTY and ran none of it.
@@ -81,7 +81,7 @@ class TestWinPtyBridgeUnavailable:
# ---------------------------------------------------------------------------
class TestWinPtyBridgeSpawn:
def test_spawn_returns_bridge_with_pid(self):
@@ -98,7 +98,7 @@ class TestWinPtyBridgeSpawn:
WinPtyBridge.spawn([bogus])
class TestWinPtyBridgeIO:
def test_write_sends_to_child_stdin(self):
@@ -137,7 +137,7 @@ class TestWinPtyBridgeIO:
bridge.close()
class TestWinPtyBridgeResize:
def test_resize_does_not_raise_on_live_child(self):
# ConPTY exposes no ioctl-equivalent for reading the child's current
@@ -165,7 +165,7 @@ class TestWinPtyBridgeResize:
bridge.resize(cols=100, rows=40)
class TestClampDimension:
"""The clamp helper is the load-bearing piece — the dashboard sends
untrusted winsize values straight from xterm.js, and pywinpty's
@@ -187,7 +187,7 @@ class TestClampDimension:
assert _clamp(float("inf"), _MAX_COLS) == 1 # type: ignore[arg-type]
class TestWinPtyBridgeClose:
def test_close_terminates_long_running_child(self):
@@ -209,7 +209,7 @@ class TestWinPtyBridgeClose:
)
class TestWinPtyBridgeEnv:
def test_cwd_is_respected(self, tmp_path):
bridge = WinPtyBridge.spawn(
diff --git a/tests/plugins/platforms/photon/test_sidecar_paths.py b/tests/plugins/platforms/photon/test_sidecar_paths.py
index 2486b45a94a..b1f1dab7fc9 100644
--- a/tests/plugins/platforms/photon/test_sidecar_paths.py
+++ b/tests/plugins/platforms/photon/test_sidecar_paths.py
@@ -88,7 +88,7 @@ def test_mirror_refresh_updates_changed_files_and_keeps_node_modules(
assert (mirror / "node_modules" / "installed.txt").exists()
def test_dir_writable_probe(tmp_path) -> None:
assert sidecar_paths.dir_writable(tmp_path) is True
ro = tmp_path / "ro"
diff --git a/tests/plugins/test_a2a_plugin.py b/tests/plugins/test_a2a_plugin.py
index ccd485555d3..678d558e7e4 100644
--- a/tests/plugins/test_a2a_plugin.py
+++ b/tests/plugins/test_a2a_plugin.py
@@ -1570,7 +1570,7 @@ class TestV1SpecRegressionFixes:
assert "one" in adapter._agents
assert "two" not in adapter._agents
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_forward_to_profile_first_contact_creates_then_resumes_fake_hermes(self, monkeypatch, tmp_path):
from plugins.platforms.a2a.adapter import A2AAdapter
from gateway.config import PlatformConfig
diff --git a/tests/run_agent/test_tool_batch_segmentation.py b/tests/run_agent/test_tool_batch_segmentation.py
index 584c66da8f8..da0d858c068 100644
--- a/tests/run_agent/test_tool_batch_segmentation.py
+++ b/tests/run_agent/test_tool_batch_segmentation.py
@@ -725,10 +725,10 @@ class TestPathCanonicalization:
)
- # ``windows_only`` rather than ``skipif(sys.platform != "win32")``: the
+ # ``platforms("windows")`` rather than ``skipif(sys.platform != "win32")``: the
# Windows CI job greps for the marker to decide which files to import, so
# a bare skipif leaves this running on no host at all.
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_case_insensitive_paths_overlap_windows(self, tmp_path):
"""On Windows, FILE.txt and file.txt are the same file — they must
be detected as overlapping after normcase() canonicalisation."""
diff --git a/tests/state/test_fts_runtime_rebuild.py b/tests/state/test_fts_runtime_rebuild.py
index 46ec418194e..f8dec25d343 100644
--- a/tests/state/test_fts_runtime_rebuild.py
+++ b/tests/state/test_fts_runtime_rebuild.py
@@ -183,7 +183,7 @@ class TestRuntimeFtsRebuild:
(222, f"{db_path}-wal (deleted)")
]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_foreign_holder_detection_proc_readlink_deleted_wal(
self, db, tmp_path, monkeypatch
):
@@ -228,7 +228,7 @@ class TestRuntimeFtsRebuild:
holders = db._foreign_state_db_holders()
assert holders == [(222, db_path_wal + " (deleted)")]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_foreign_holder_uninspectable_process_cmdline_fallback(
self, db, tmp_path, monkeypatch
):
diff --git a/tests/test_atomic_replace_symlinks.py b/tests/test_atomic_replace_symlinks.py
index 797d2b3a12d..d3fd4b575fb 100644
--- a/tests/test_atomic_replace_symlinks.py
+++ b/tests/test_atomic_replace_symlinks.py
@@ -290,7 +290,7 @@ def test_atomic_replace_real_cross_device(tmp_path: Path) -> None:
# *source* reports. The cross-platform tests below therefore simulate
# winerror 5, matching what production actually raises.
#
-# The real-handle tests use @pytest.mark.windows_only rather than a bare
+# The real-handle tests use @pytest.mark.platforms("windows") rather than a bare
# `skip(os.name != "nt")`: scripts/ci/list_os_marked_tests.py greps for the
# MARKER NAME to decide which files the Windows lane imports, so a plain
# skipif would leave them running on no host at all.
@@ -533,7 +533,7 @@ def test_symlinked_target_survives_a_contended_rename(
# ── native Windows: real contended handles ────────────────────────────────
def test_windows_real_held_read_handle_lands_the_write(tmp_path: Path) -> None:
"""The reported bug, end to end against a real held handle."""
target = tmp_path / "gateway_state.json"
@@ -547,7 +547,7 @@ def test_windows_real_held_read_handle_lands_the_write(tmp_path: Path) -> None:
assert not tmp.exists()
def test_windows_real_held_handle_reports_access_denied(tmp_path: Path) -> None:
"""Pin the premise this fix is built on: a held *target* handle raises
winerror 5, not 32. If CPython ever changes that, the classification in
@@ -567,7 +567,7 @@ def test_windows_real_held_handle_reports_access_denied(tmp_path: Path) -> None:
assert utils_mod._is_contended_windows_replace_error(caught.value)
def test_windows_atomic_json_write_with_concurrent_reader(
tmp_path: Path,
) -> None:
@@ -584,7 +584,7 @@ def test_windows_atomic_json_write_with_concurrent_reader(
assert leftovers == [], f"orphaned temp files: {leftovers}"
def test_windows_readonly_target_still_raises(tmp_path: Path) -> None:
"""A genuinely unwritable target must not be rescued by the fallback."""
import subprocess
diff --git a/tests/test_bitwarden_secrets.py b/tests/test_bitwarden_secrets.py
index 3fb0cf15d84..ef197e79d40 100644
--- a/tests/test_bitwarden_secrets.py
+++ b/tests/test_bitwarden_secrets.py
@@ -135,7 +135,7 @@ def test_safe_extract_member_rejects_traversal(tmp_path, evil_name):
def test_install_bws_happy_path(hermes_home, monkeypatch):
fake_binary = b"#!/bin/sh\necho 'bws fake 2.0.0'\n"
zip_bytes = _make_fake_zip(fake_binary)
@@ -335,7 +335,7 @@ def test_disk_cache_key_mismatch_triggers_refetch(monkeypatch, tmp_path):
def test_encrypted_cache_writes_without_plaintext(monkeypatch, tmp_path):
"""Encrypted cache stores last-good secrets without raw values on disk."""
home = tmp_path / ".hermes"
diff --git a/tests/test_desktop_update_windows_pipe_drain.py b/tests/test_desktop_update_windows_pipe_drain.py
index d3cd1e8ee80..61beb2274d0 100644
--- a/tests/test_desktop_update_windows_pipe_drain.py
+++ b/tests/test_desktop_update_windows_pipe_drain.py
@@ -39,7 +39,7 @@ and finally paths can write the result, remove the marker, and relaunch Desktop.
So the contract is: bounded when a descendant holds the pipe open, never slower
than the step can write, and bounded when the step itself remains alive without
observable progress. All arms live in the script's own
-``-SelfTestPipeDrain`` fixture, which is ``windows_only`` because Linux CI
+``-SelfTestPipeDrain`` fixture, which is ``platforms("windows")`` because Linux CI
cannot execute the PowerShell hand-off.
"""
@@ -68,7 +68,7 @@ class TestIdleWatchdogCountsUpdateLogGrowth:
exit 124.
These are source-contract assertions (the executable proof is the
- ``logstall`` arm of ``-SelfTestPipeDrain``, ``windows_only`` below):
+ ``logstall`` arm of ``-SelfTestPipeDrain``, ``platforms("windows")`` below):
Linux CI cannot run the PowerShell hand-off, but it CAN pin that the
drain loop consults update-log growth before terminating the tree.
Sabotage-proof: removing the ``Get-StepProgressLogStamp`` consult from
@@ -124,7 +124,7 @@ class TestIdleWatchdogCountsUpdateLogGrowth:
assert "silent but logging" in src
def test_update_step_survives_pipe_leak_flood_and_live_child_stall(
tmp_path: Path,
) -> None:
diff --git a/tests/test_desktop_update_windows_progress.py b/tests/test_desktop_update_windows_progress.py
index 031971570ec..38e1a7fa57a 100644
--- a/tests/test_desktop_update_windows_progress.py
+++ b/tests/test_desktop_update_windows_progress.py
@@ -20,7 +20,7 @@ from urllib.request import urlopen
import pytest
-pytestmark = pytest.mark.windows_only
+pytestmark = pytest.mark.platforms("windows")
REPO_ROOT = Path(__file__).resolve().parent.parent
WINDOWS_UPDATE_PS1 = REPO_ROOT / "scripts" / "desktop-update" / "windows.ps1"
diff --git a/tests/test_desktop_update_windows_retry_policy.py b/tests/test_desktop_update_windows_retry_policy.py
index 8fafbca24c5..68e86c6ff5a 100644
--- a/tests/test_desktop_update_windows_retry_policy.py
+++ b/tests/test_desktop_update_windows_retry_policy.py
@@ -13,7 +13,7 @@ REPO_ROOT = Path(__file__).resolve().parent.parent
RETRY_POLICY = REPO_ROOT / "scripts" / "desktop-update" / "retry-policy.ps1"
def test_retry_policy_distinguishes_self_lock_deferral(tmp_path: Path) -> None:
install_root = tmp_path / "hermes-agent"
install_root.mkdir()
diff --git a/tests/test_hermes_bootstrap.py b/tests/test_hermes_bootstrap.py
index c2e3dc43b03..d9f2035c7f7 100644
--- a/tests/test_hermes_bootstrap.py
+++ b/tests/test_hermes_bootstrap.py
@@ -46,7 +46,7 @@ def _fresh_import():
class TestWindowsBehavior:
"""Windows: the bootstrap does its job."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_env_vars_set_on_windows(self, monkeypatch):
# Clear any pre-existing values and re-run bootstrap.
monkeypatch.delenv("PYTHONUTF8", raising=False)
@@ -57,7 +57,7 @@ class TestWindowsBehavior:
assert os.environ.get("PYTHONIOENCODING") == "utf-8"
assert hb._bootstrap_applied is True
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_stdout_reconfigured_to_utf8_on_windows(self):
# The live process's stdout should now be UTF-8 (the Hermes CLI
# runs on Windows with a pytest console that's cp1252 by default).
@@ -77,7 +77,7 @@ class TestWindowsBehavior:
"reconfigured it to UTF-8"
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_child_process_inherits_utf8_mode(self):
"""A subprocess spawned from this process should inherit
PYTHONUTF8=1 and be able to print non-ASCII to stdout."""
@@ -110,7 +110,7 @@ class TestUserOptOut:
"""If the user has explicitly set PYTHONUTF8 / PYTHONIOENCODING in
their environment, we respect that (setdefault, not overwrite)."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_user_pythonutf8_zero_preserved(self, monkeypatch):
monkeypatch.setenv("PYTHONUTF8", "0")
_fresh_import()
@@ -125,7 +125,7 @@ class TestPosixNoOp:
stdio. The goal is that Linux/macOS behave identically before and
after this module is imported."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_noop_on_posix_host(self, monkeypatch):
"""Even when imported, the bootstrap function must return False
and leave env untouched on a POSIX host (``_IS_WINDOWS`` is
@@ -164,12 +164,12 @@ class TestStdioReconfigureErrorHandling:
don't support reconfigure (e.g. by a test harness), the bootstrap
must degrade gracefully rather than crash."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_non_reconfigurable_stream_does_not_crash(self, monkeypatch):
"""Replace sys.stdout with a BytesIO (no reconfigure method),
then run the bootstrap and make sure it doesn't raise.
- ``windows_only``: forcing ``_IS_WINDOWS = True`` on Linux was the only
+ ``platforms("windows")``: forcing ``_IS_WINDOWS = True`` on Linux was the only
thing that made the reconfigure block reachable — off Windows the
bootstrap returns before touching stdio, so the test proved nothing
about the guard it names.
@@ -337,7 +337,7 @@ class TestHardenImportPath:
class TestSuppressPlatformVerConsole:
"""suppress_platform_ver_console: stub applied on Windows, no-op on POSIX."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_noop_on_posix(self):
import platform
hb = _fresh_import()
@@ -345,7 +345,7 @@ class TestSuppressPlatformVerConsole:
hb.suppress_platform_ver_console()
assert getattr(platform, "_syscmd_ver", None) is original
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_stub_applied_when_windows(self):
# Faking _IS_WINDOWS on Linux asserted only that the stub was
# installed; the reason it exists — ``platform.win32_ver()`` shelling
diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.py
index ec952da9c7a..56985cd778f 100644
--- a/tests/test_hermes_constants.py
+++ b/tests/test_hermes_constants.py
@@ -33,7 +33,7 @@ from hermes_constants import (
class TestGetDefaultHermesRoot:
"""Tests for get_default_hermes_root() — Docker/custom deployment awareness."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_no_hermes_home_returns_native(self, tmp_path, monkeypatch):
"""When HERMES_HOME is not set, returns ~/.hermes."""
monkeypatch.delenv("HERMES_HOME", raising=False)
@@ -55,7 +55,7 @@ class TestGetDefaultHermesRoot:
monkeypatch.setenv("HERMES_HOME", str(profile))
assert get_default_hermes_root() == docker_root
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_no_hermes_home_returns_localappdata_root_on_windows(self, tmp_path, monkeypatch):
"""Native Windows falls back to %LOCALAPPDATA%\\hermes, not ~/.hermes."""
local_appdata = tmp_path / "LocalAppData"
@@ -128,7 +128,7 @@ class TestGetDefaultHermesRoot:
class TestGetHermesHome:
"""Tests for get_hermes_home() platform-aware fallback."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_fallback_uses_localappdata(self, tmp_path, monkeypatch):
"""When HERMES_HOME is unset on Windows, use %LOCALAPPDATA%\\hermes."""
local_appdata = tmp_path / "LocalAppData"
@@ -157,7 +157,7 @@ class TestGetProcessHermesHome:
class TestHermesManagedNode:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_node_dir_prefers_portable_root(self, tmp_path, monkeypatch):
home = tmp_path / "hermes"
node_dir = home / "node"
@@ -168,7 +168,7 @@ class TestHermesManagedNode:
assert iter_hermes_node_dirs() == [node_dir, bin_dir]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_finds_npm_cmd_before_path(self, tmp_path, monkeypatch):
home = tmp_path / "hermes"
node_dir = home / "node"
@@ -182,7 +182,7 @@ class TestHermesManagedNode:
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_skips_broken_managed_npm_without_path_fallback(self, tmp_path, monkeypatch):
home = tmp_path / "hermes"
managed_npm = home / "node" / "npm.cmd"
diff --git a/tests/test_hermes_home_profile_warning.py b/tests/test_hermes_home_profile_warning.py
index 492636e9fd2..c369d75a134 100644
--- a/tests/test_hermes_home_profile_warning.py
+++ b/tests/test_hermes_home_profile_warning.py
@@ -30,7 +30,7 @@ def fresh_constants(monkeypatch, tmp_path):
class TestGetHermesHomeProfileWarning:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_classic_mode_no_active_profile_no_warning(
self, fresh_constants, tmp_path, capsys
):
@@ -40,7 +40,7 @@ class TestGetHermesHomeProfileWarning:
assert "HERMES_HOME fallback" not in capsys.readouterr().err
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_named_profile_unset_home_warns_once(
self, fresh_constants, tmp_path, capsys
):
@@ -79,7 +79,7 @@ class TestGetHermesHomeProfileWarning:
assert result == profile_dir
assert "HERMES_HOME fallback" not in capsys.readouterr().err
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_unreadable_active_profile_no_crash(
self, fresh_constants, tmp_path, capsys
):
diff --git a/tests/test_hermes_logging.py b/tests/test_hermes_logging.py
index dd0989037cb..0eff810c0a4 100644
--- a/tests/test_hermes_logging.py
+++ b/tests/test_hermes_logging.py
@@ -382,7 +382,7 @@ class TestAddRotatingHandler:
logger.removeHandler(h)
h.close()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_managed_mode_initial_open_sets_group_writable(self, tmp_path):
log_path = tmp_path / "managed-open.log"
logger = logging.getLogger("_test_rotating_managed_open")
@@ -425,7 +425,7 @@ class TestWindowsConcurrentLogLockTimeout:
logger.addHandler(handler)
return logger, handler
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_helper_only_matches_windows_concurrent_lock_timeout(self):
# Windows-only: concurrent-log-handler (and therefore its cross-process
# lock timeout) is only installed on Windows — faking sys.platform
@@ -437,7 +437,7 @@ class TestWindowsConcurrentLogLockTimeout:
RuntimeError("some other logging failure")
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_helper_never_matches_off_windows(self):
# On POSIX the suppression must stay inert: stdlib RotatingFileHandler
# is in use, so this RuntimeError text is never a CLH lock timeout.
@@ -445,7 +445,7 @@ class TestWindowsConcurrentLogLockTimeout:
RuntimeError("Cannot acquire lock after 20 attempts")
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_lock_timeout_routed_to_handle_error_is_suppressed(self, tmp_path, capsys):
"""Mirror CLH's real control flow.
diff --git a/tests/test_install_autostash_conflict_recovery.py b/tests/test_install_autostash_conflict_recovery.py
index 44f8ca90f55..bd2f0561ded 100644
--- a/tests/test_install_autostash_conflict_recovery.py
+++ b/tests/test_install_autostash_conflict_recovery.py
@@ -79,7 +79,7 @@ def _assert_conflict_was_recovered(repo: Path, output: str) -> None:
@pytest.mark.live_system_guard_bypass
@pytest.mark.skipif(
shutil.which("git") is None or shutil.which("bash") is None,
reason="needs git and bash",
@@ -138,7 +138,7 @@ def test_install_ps1_repository_stage_recovers_from_autostash_conflict(
@pytest.mark.live_system_guard_bypass
@pytest.mark.skipif(
shutil.which("git") is None or shutil.which("bash") is None,
reason="needs git and bash",
diff --git a/tests/test_install_macos_launcher.py b/tests/test_install_macos_launcher.py
index ce4d1aa731b..200c16a85ff 100644
--- a/tests/test_install_macos_launcher.py
+++ b/tests/test_install_macos_launcher.py
@@ -11,7 +11,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.macos_only
+pytestmark = pytest.mark.platforms("macos")
REPO_ROOT = Path(__file__).resolve().parent.parent
diff --git a/tests/test_install_sh_acp_launcher.py b/tests/test_install_sh_acp_launcher.py
index 3cda1866abb..ec394bbfd6f 100644
--- a/tests/test_install_sh_acp_launcher.py
+++ b/tests/test_install_sh_acp_launcher.py
@@ -67,7 +67,7 @@ def _run_block(tmp_path: Path, use_venv: str) -> Path:
return command_link_dir / "hermes-acp"
def test_venv_install_writes_executable_acp_launcher(tmp_path):
shim = _run_block(tmp_path, "true")
assert shim.is_file()
@@ -81,14 +81,14 @@ def test_venv_install_writes_executable_acp_launcher(tmp_path):
assert re.search(r'exec .*\bacp\b', text), text
def test_non_venv_install_writes_acp_launcher(tmp_path):
shim = _run_block(tmp_path, "false")
text = shim.read_text(encoding="utf-8")
assert re.search(r'exec .*\bacp\b', text), text
def test_acp_launcher_does_not_follow_a_symlink_into_the_venv(tmp_path):
"""Guards the #21454 failure mode for the new launcher.
@@ -190,7 +190,7 @@ def _run_hermes_agent_block(tmp_path: Path, use_venv: str) -> Path | None:
return command_link_dir / "hermes-agent"
def test_venv_install_writes_executable_hermes_agent_launcher(tmp_path):
"""venv install must write a user-executable hermes-agent launcher."""
shim = _run_hermes_agent_block(tmp_path, "true")
diff --git a/tests/test_install_sh_bootstrap_marker.py b/tests/test_install_sh_bootstrap_marker.py
index 4a553756ab3..7ef97f8d376 100644
--- a/tests/test_install_sh_bootstrap_marker.py
+++ b/tests/test_install_sh_bootstrap_marker.py
@@ -16,7 +16,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
REPO_ROOT = Path(__file__).resolve().parent.parent
INSTALL_SH = REPO_ROOT / "scripts" / "install.sh"
diff --git a/tests/test_install_sh_node_deps_failure.py b/tests/test_install_sh_node_deps_failure.py
index 2ecf9e67327..d009e5f8ee4 100644
--- a/tests/test_install_sh_node_deps_failure.py
+++ b/tests/test_install_sh_node_deps_failure.py
@@ -9,7 +9,7 @@ from pathlib import Path
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
REPO_ROOT = Path(__file__).resolve().parent.parent
diff --git a/tests/test_install_sh_symlink_stomp.py b/tests/test_install_sh_symlink_stomp.py
index 557e284e071..7a35522e0e4 100644
--- a/tests/test_install_sh_symlink_stomp.py
+++ b/tests/test_install_sh_symlink_stomp.py
@@ -59,7 +59,7 @@ def test_setup_path_shim_block_removes_old_link_before_writing() -> None:
)
def test_re_running_setup_path_block_preserves_pip_entry_point(tmp_path: Path) -> None:
"""Behavioral repro: simulate prior-install symlink + new-install heredoc.
diff --git a/tests/test_iron_proxy.py b/tests/test_iron_proxy.py
index 149c27a02e3..33e00abef4a 100644
--- a/tests/test_iron_proxy.py
+++ b/tests/test_iron_proxy.py
@@ -341,7 +341,7 @@ def test_subprocess_env_strips_unrelated_secrets(hermes_home, monkeypatch):
# ---------------------------------------------------------------------------
def test_ca_key_created_with_0o600(hermes_home, monkeypatch):
"""The CA private key must NEVER exist on disk with default umask
permissions, even transiently. Fix: open with explicit mode=0o600
@@ -377,7 +377,7 @@ def test_ca_key_created_with_0o600(hermes_home, monkeypatch):
# ---------------------------------------------------------------------------
def test_ensure_audit_log_creates_with_0o600(hermes_home, tmp_path):
audit = tmp_path / "audit.log"
ip.ensure_audit_log(audit)
@@ -386,7 +386,7 @@ def test_ensure_audit_log_creates_with_0o600(hermes_home, tmp_path):
assert mode == 0o600
def test_ensure_audit_log_tightens_existing_perms(hermes_home, tmp_path):
audit = tmp_path / "audit.log"
audit.write_text("preexisting content\n")
@@ -401,7 +401,7 @@ def test_ensure_audit_log_tightens_existing_perms(hermes_home, tmp_path):
# ---------------------------------------------------------------------------
def test_proxy_state_dir_is_0o700(hermes_home):
state = ip._proxy_state_dir()
mode = state.stat().st_mode & 0o777
@@ -489,7 +489,7 @@ def test_mappings_roundtrip_preserves_headers_and_aliases(hermes_home):
def test_ensure_management_token_persists_and_is_stable(hermes_home):
t1 = ip.ensure_management_token()
t2 = ip.ensure_management_token()
@@ -544,7 +544,7 @@ def test_reload_proxy_posts_bearer_to_management_endpoint(hermes_home, monkeypat
assert captured["auth"] == f"Bearer {token}"
def test_start_proxy_injects_management_key_env(hermes_home, monkeypatch):
"""When the generated config has a management listener, start_proxy
must inject the bearer key env var — v0.39 refuses to start when
diff --git a/tests/test_live_system_guard_self_test.py b/tests/test_live_system_guard_self_test.py
index dfc06c7215d..aa44d720598 100644
--- a/tests/test_live_system_guard_self_test.py
+++ b/tests/test_live_system_guard_self_test.py
@@ -105,7 +105,7 @@ def test_fail_closed_probe_classifies_raw_builtin_as_unguarded():
# ──────────────────── kill primitives ─────────────────────────
def test_os_kill_blocks_foreign_pid():
with pytest.raises(RuntimeError, match="live-system guard"):
os.kill(FOREIGN_PID, signal.SIGTERM)
@@ -219,7 +219,7 @@ def test_os_popen_systemctl_blocked():
# ──────────────────── pty.spawn ────────────────────────────────
def test_pty_spawn_systemctl_blocked():
import pty
with pytest.raises(RuntimeError, match="live-system guard"):
diff --git a/tests/test_os_marker_gating.py b/tests/test_os_marker_gating.py
index 5d348fd73e9..8e4dad72aff 100644
--- a/tests/test_os_marker_gating.py
+++ b/tests/test_os_marker_gating.py
@@ -1,8 +1,8 @@
-"""The collection guard against a test carrying two host-OS markers.
+"""The collection guard against a test carrying two platforms() markers.
-Every marker in ``_OS_MARKS`` skips on all but one host, so two of them on one
-item means it runs on no host at all while both the Linux suite and the
-tests-os lanes report green. tests/conftest.py fails collection instead; this
+A module-level gate stacked on a per-test gate ran on no host at all while
+both the full-suite and marked lanes reported green — the silent coverage
+loss the guard exists for. tests/conftest.py fails collection instead; this
pins that behaviour so the guard can't be dropped silently.
"""
@@ -10,51 +10,54 @@ from __future__ import annotations
import pytest
-from tests.conftest import _OS_MARKS, _reject_multiple_os_marks
+from tests.conftest import _reject_contradictory_platform_marks
class _FakeItem:
"""Stands in for a collected item: the guard reads only these two."""
- def __init__(self, nodeid: str, *marks: str) -> None:
+ def __init__(self, nodeid: str, *marks) -> None:
self.nodeid = nodeid
- self._marks = [getattr(pytest.mark, name).mark for name in marks]
+ self._marks = list(marks)
- def iter_markers(self):
- return iter(self._marks)
+ def iter_markers(self, name=None):
+ if name is None:
+ return iter(self._marks)
+ return iter(m for m in self._marks if m.name == name)
-def test_single_os_marker_is_accepted():
- items = [_FakeItem(f"t.py::test_{name}", name) for name in _OS_MARKS]
- _reject_multiple_os_marks(items) # must not raise
+def test_single_platforms_marker_is_accepted():
+ items = [
+ _FakeItem("t.py::test_linux", pytest.mark.platforms("linux")),
+ _FakeItem("t.py::test_win", pytest.mark.platforms("windows", arch="arm64")),
+ _FakeItem("t.py::test_not", pytest.mark.platforms("not macos")),
+ ]
+ _reject_contradictory_platform_marks(items) # must not raise
-def test_unmarked_and_non_os_markers_are_accepted():
- _reject_multiple_os_marks([
- _FakeItem("t.py::test_plain"),
- _FakeItem("t.py::test_other", "slow", "integration"),
- ])
+def test_unmarked_and_non_platform_markers_are_accepted():
+ _reject_contradictory_platform_marks(
+ [
+ _FakeItem("t.py::test_plain"),
+ _FakeItem("t.py::test_slow", pytest.mark.slow),
+ ]
+ )
-def test_two_os_markers_fail_collection():
+def test_two_platforms_markers_fail_collection():
items = [
- _FakeItem("t.py::test_ok", "linux_only"),
- _FakeItem("t.py::test_bad", "linux_only", "windows_only"),
+ _FakeItem("t.py::test_ok", pytest.mark.platforms("linux")),
+ _FakeItem(
+ "t.py::test_bad",
+ pytest.mark.platforms("linux"),
+ pytest.mark.platforms("windows"),
+ ),
]
with pytest.raises(pytest.UsageError) as excinfo:
- _reject_multiple_os_marks(items)
+ _reject_contradictory_platform_marks(items)
message = str(excinfo.value)
assert "t.py::test_bad" in message
- assert "linux_only, windows_only" in message
+ assert "at most one platforms()" in message
# The passing item must not be named — the error is a list of offenders.
assert "t.py::test_ok" not in message
-
-
-def test_all_three_markers_are_reported_together():
- item = _FakeItem("t.py::test_worst", *_OS_MARKS)
- with pytest.raises(pytest.UsageError) as excinfo:
- _reject_multiple_os_marks([item])
-
- for name in _OS_MARKS:
- assert name in str(excinfo.value)
diff --git a/tests/test_platforms_marker.py b/tests/test_platforms_marker.py
index 4f1237d30c5..6d7af9e4080 100644
--- a/tests/test_platforms_marker.py
+++ b/tests/test_platforms_marker.py
@@ -1,7 +1,7 @@
"""The composable ``platforms`` marker: spec evaluation + collection gating.
Behavior-contract tests for the gate introduced alongside the fixed
-linux_only/macos_only/windows_only trio: any-of semantics, negation,
+platforms("linux")/platforms("macos")/platforms("windows") trio: any-of semantics, negation,
POSIX grouping, arch filters, and the hard errors on unknown specs and
stray keyword arguments.
"""
diff --git a/tests/test_resource_limits.py b/tests/test_resource_limits.py
index c3f8cbab855..0dcef090b8c 100644
--- a/tests/test_resource_limits.py
+++ b/tests/test_resource_limits.py
@@ -249,7 +249,7 @@ def test_serve_startup_applies_limit_before_web_server(monkeypatch):
assert calls == ["limit", "server"]
def test_named_profile_reroute_defers_limit_to_final_process(monkeypatch, tmp_path):
"""The launcher profile must not leak its limit across machine re-exec."""
from hermes_cli import main as cli_main
diff --git a/tests/test_web_server.py b/tests/test_web_server.py
index 7ab1e7032b2..f848fd56b2f 100644
--- a/tests/test_web_server.py
+++ b/tests/test_web_server.py
@@ -148,7 +148,7 @@ def test_start_server_enables_ws_ping_for_half_open_detection(monkeypatch):
assert captured["ws_ping_timeout"] >= captured["ws_ping_interval"]
def test_start_server_runs_on_uvicorns_loop_factory(monkeypatch):
"""The dashboard/desktop backend must serve uvicorn on the loop *uvicorn*
selects, not the interpreter default.
@@ -207,7 +207,7 @@ def test_start_server_runs_on_uvicorns_loop_factory(monkeypatch):
)
def test_start_server_keeps_bare_asyncio_run_on_posix(monkeypatch):
"""POSIX continues to serve via the plain ``asyncio.run(_serve())`` path,
never the Windows loop-factory branch.
@@ -274,7 +274,7 @@ def test_start_server_treats_posix_keyboardinterrupt_as_clean_shutdown(monkeypat
)
def test_start_server_treats_windows_keyboardinterrupt_as_clean_shutdown(monkeypatch):
"""Console Ctrl+C on the Windows loop-factory branch is a clean exit too.
@@ -307,7 +307,7 @@ def test_start_server_treats_windows_keyboardinterrupt_as_clean_shutdown(monkeyp
)
def test_start_server_treats_windows_fallback_keyboardinterrupt_as_clean_shutdown(
monkeypatch,
):
diff --git a/tests/test_windows_subprocess_no_window_flags.py b/tests/test_windows_subprocess_no_window_flags.py
index cc127452844..706bfc06023 100644
--- a/tests/test_windows_subprocess_no_window_flags.py
+++ b/tests/test_windows_subprocess_no_window_flags.py
@@ -68,12 +68,12 @@ def _make_fake_popen(spawns, *, stdout="ok\n", returncode=0):
return _FakePopen
def test_bounded_git_probe_fast_path_spawn_contract_windows(monkeypatch):
"""The normal-path spawn contract survives the run()->Popen rewrite:
PIPE/PIPE/DEVNULL, text + utf-8/replace, hidden-window flags on Windows.
- ``windows_only``: the ``creationflags`` assertion is the point, and
+ ``platforms("windows")``: the ``creationflags`` assertion is the point, and
``bounded_git_probe`` only sets that key when ``IS_WINDOWS`` — which the
helper caches from the real platform at import. ``windows_hide_flags`` is
still stubbed so the expected value is a fixed constant rather than
@@ -156,9 +156,9 @@ def test_bounded_git_probe_spawn_failure_returns_empty(monkeypatch):
def test_shell_hooks_hide_hook_command_windows(monkeypatch):
- """``windows_only``: ``shell_hooks._spawn`` only adds ``creationflags``
+ """``platforms("windows")``: ``shell_hooks._spawn`` only adds ``creationflags``
under its module-level ``IS_WINDOWS``, so on Linux the flag patch was
what created the thing being asserted."""
from agent import shell_hooks
@@ -402,12 +402,12 @@ def test_lazy_deps_uv_install_hides_console_window(monkeypatch):
def test_suppress_platform_ver_console_stubs_syscmd_ver(monkeypatch):
"""``_syscmd_ver`` is replaced by an in-process echo stub so win32_ver()
takes its ValueError fallback instead of shelling out to `cmd /c ver`.
- ``windows_only``: ``suppress_platform_ver_console()`` is a no-op unless
+ ``platforms("windows")``: ``suppress_platform_ver_console()`` is a no-op unless
``IS_WINDOWS``, and the console flash it prevents (``cmd /c ver``) only
exists on Windows — the old flag patch installed the stub on a host where
``win32_ver`` is never consulted at all.
diff --git a/tests/tools/test_approval.py b/tests/tools/test_approval.py
index 54091d473f3..262a6cdb232 100644
--- a/tests/tools/test_approval.py
+++ b/tests/tools/test_approval.py
@@ -99,7 +99,7 @@ class TestDetectDangerousRm:
assert "delete" in desc.lower()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_nonrecursive_verification_artifact_cleanup_is_not_dangerous(self):
with mock_patch("tempfile.gettempdir", return_value="/tmp"):
for prefix in ("hermes-verify-", "hermes-ad-hoc-"):
diff --git a/tests/tools/test_approved_command_clean_slate.py b/tests/tools/test_approved_command_clean_slate.py
index b9b087eda2b..817a99ab485 100644
--- a/tests/tools/test_approved_command_clean_slate.py
+++ b/tests/tools/test_approved_command_clean_slate.py
@@ -86,7 +86,7 @@ def test_non_approved_command_still_interrupts_on_stale_bit(monkeypatch):
assert "[Command interrupted]" in result["output"]
def test_approved_command_genuine_interrupt_after_start_still_kills(tmp_path):
"""The clean-slate clear must NOT make approved commands un-interruptible:
an interrupt that arrives after execution starts still SIGINTs (130)."""
@@ -113,7 +113,7 @@ def test_approved_command_genuine_interrupt_after_start_still_kills(tmp_path):
set_interrupt(False, thread_id=t.ident)
def test_approved_note_enriched_not_misleading_on_interrupt(monkeypatch, tmp_path):
"""On a genuine post-start interrupt of an approved command, the note must
read '...approved by the user, then interrupted.' — the bare
diff --git a/tests/tools/test_async_delegation.py b/tests/tools/test_async_delegation.py
index 5d0a01c22a6..a5852d45ded 100644
--- a/tests/tools/test_async_delegation.py
+++ b/tests/tools/test_async_delegation.py
@@ -100,7 +100,7 @@ def test_schema_init_preserves_shared_state_db_wal_mode(tmp_path):
conn.close()
def test_connect_preserves_wal_and_applies_macos_durability_barriers(
tmp_path, monkeypatch
):
diff --git a/tests/tools/test_base_environment.py b/tests/tools/test_base_environment.py
index 759aa504ab8..8529597eef0 100644
--- a/tests/tools/test_base_environment.py
+++ b/tests/tools/test_base_environment.py
@@ -191,7 +191,7 @@ class TestAtomicSnapshotConcurrencyBehavioral:
import subprocess
return subprocess.run(["/bin/bash", "-c", script], capture_output=True, text=True)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_concurrent_writes_never_tear_the_snapshot(self, tmp_path):
import shutil
if not shutil.which("bash"):
@@ -229,7 +229,7 @@ class TestAtomicSnapshotConcurrencyBehavioral:
final = self._run(f"source {_q(snap)} >/dev/null 2>&1 && echo OK || echo BROKEN")
assert "OK" in final.stdout, f"final snapshot not sourceable: {final.stdout} {final.stderr}"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_failed_export_does_not_destroy_good_snapshot(self, tmp_path):
"""If ``export -p`` fails, the ``&&``-chained mv must NOT clobber the
existing good snapshot."""
@@ -257,7 +257,7 @@ class TestAtomicSnapshotConcurrencyBehavioral:
class TestSnapshotFileModes:
"""Snapshot metadata files are private without changing user command umask."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_snapshot_and_cwd_files_are_0600(self, tmp_path):
import os
from pathlib import Path
diff --git a/tests/tools/test_bot_mode_dm.py b/tests/tools/test_bot_mode_dm.py
index 10cb5a372c6..670dc2062cf 100644
--- a/tests/tools/test_bot_mode_dm.py
+++ b/tests/tools/test_bot_mode_dm.py
@@ -533,7 +533,7 @@ def test_real_delivery_command_round_trip(tmp_path, stdin_file):
assert not dm_file.exists()
def test_delivery_command_round_trip_through_windows_local_shell(tmp_path):
"""Native runner paths must survive the Git Bash process boundary."""
from tools.environments.local import _find_shell
@@ -666,7 +666,7 @@ def test_sweeper_removes_only_stale_dm_files(tmp_path, monkeypatch):
assert unrelated.exists()
def test_dm_dir_is_private_and_uid_scoped_on_posix(tmp_path, monkeypatch):
monkeypatch.setattr(bot_mode_dm.tempfile, "gettempdir", lambda: str(tmp_path))
@@ -679,7 +679,7 @@ def test_dm_dir_is_private_and_uid_scoped_on_posix(tmp_path, monkeypatch):
assert dm_dir.stat().st_mode & 0o777 == 0o700
def test_dm_dir_repairs_restrictive_owner_mode(tmp_path, monkeypatch):
monkeypatch.setattr(bot_mode_dm.tempfile, "gettempdir", lambda: str(tmp_path))
uid = os.getuid() if hasattr(os, "getuid") else None
diff --git a/tests/tools/test_bot_relay_windows_paths.py b/tests/tools/test_bot_relay_windows_paths.py
index fdb6a812e6f..a60461f4c03 100644
--- a/tests/tools/test_bot_relay_windows_paths.py
+++ b/tests/tools/test_bot_relay_windows_paths.py
@@ -51,7 +51,7 @@ def test_waiter_windows_path_compiles_after_backslash_folding():
compile(folded, "<waiter>", "exec")
def test_waiter_posix_path_and_label_values_roundtrip():
"""On POSIX (backslash-free paths) the raw prefix changes nothing."""
root = Path("/tmp/hermes-home")
@@ -90,7 +90,7 @@ def test_waiter_raw_prefix_keeps_injection_defense():
assert "x'); __import__('sys').exit(2); print('x" in code
def test_local_delivery_resolves_sibling_hermes(tmp_path, monkeypatch):
bin_dir = tmp_path / "venv" / "bin"
bin_dir.mkdir(parents=True)
diff --git a/tests/tools/test_bot_turn_lock.py b/tests/tools/test_bot_turn_lock.py
index 25e0fd72794..3d9c6d7d59d 100644
--- a/tests/tools/test_bot_turn_lock.py
+++ b/tests/tools/test_bot_turn_lock.py
@@ -21,7 +21,7 @@ import time
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
from tools import bot_mode_dm, bot_relay
from tools.bot_relay import TurnBusyError, acquire_turn_lock, turn_lock_path
diff --git a/tests/tools/test_browser_homebrew_paths.py b/tests/tools/test_browser_homebrew_paths.py
index 578e9bb7989..62237a512bb 100644
--- a/tests/tools/test_browser_homebrew_paths.py
+++ b/tests/tools/test_browser_homebrew_paths.py
@@ -406,7 +406,7 @@ class TestRunBrowserCommandPathConstruction:
]
assert captured_cmd[5:9] == ["--session", "test-session", "--json", "navigate"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_subprocess_path_includes_termux_fallback_dirs(self, tmp_path):
"""Termux fallback dirs should survive browser PATH rebuilding."""
captured_env = {}
diff --git a/tests/tools/test_browser_npx_warmup.py b/tests/tools/test_browser_npx_warmup.py
index 37fe84b4375..a61101caaeb 100644
--- a/tests/tools/test_browser_npx_warmup.py
+++ b/tests/tools/test_browser_npx_warmup.py
@@ -125,7 +125,7 @@ def test_merges_extended_path_so_managed_only_npx_can_find_sibling_node():
assert kwargs["env"]["PATH"] == "/opt/hermes/node/bin:/usr/bin"
def test_runs_in_its_own_process_group_on_posix(monkeypatch):
monkeypatch.setattr("os.name", "posix")
with patch("tools.browser_tool._resolve_npx_bin", return_value="/usr/bin/npx"), \
@@ -219,7 +219,7 @@ def test_returns_false_instead_of_raising_on_unexpected_communicate_exception():
mock_kill.assert_called_once_with(proc)
class TestLegacyKillProcessTree:
"""Contract of the pre-#85125 local fallback (used when agent.deadline
delegation fails); the delegating wrapper is covered in
diff --git a/tests/tools/test_browser_real_profile.py b/tests/tools/test_browser_real_profile.py
index df0c865c215..4009b76ef7c 100644
--- a/tests/tools/test_browser_real_profile.py
+++ b/tests/tools/test_browser_real_profile.py
@@ -145,7 +145,7 @@ class TestSnapshotRealProfile:
assert dst is None
assert err and "was not found" in err
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_snapshot_files_are_owner_only(self, tmp_path, monkeypatch):
"""Every copied file must be 0600 and every dir 0700 (#96729).
@@ -177,7 +177,7 @@ class TestSnapshotRealProfile:
offenders.append((os.path.join(root, f), oct(mode)))
assert not offenders, f"group/world-accessible snapshot entries: {offenders}"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_existing_lax_snapshot_heals_on_refresh(self, tmp_path, monkeypatch):
"""A snapshot left 0644 by an older build tightens on the next pass."""
import stat
diff --git a/tests/tools/test_browser_use_cli.py b/tests/tools/test_browser_use_cli.py
index c8b3f7c0e5b..8b84e07839e 100644
--- a/tests/tools/test_browser_use_cli.py
+++ b/tests/tools/test_browser_use_cli.py
@@ -348,7 +348,7 @@ class TestLegacyCloudMigration:
monkeypatch.setattr(bu_cli, "_find_cli", lambda: None)
assert bu_cli.is_browser_use_cli_mode() is False
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_migrated_config_gets_bu_autospawn(self, tmp_path, monkeypatch):
monkeypatch.setattr("hermes_cli.config.read_raw_config", lambda: self._LEGACY)
monkeypatch.setenv("BROWSER_USE_API_KEY", "bu-key")
@@ -357,7 +357,7 @@ class TestLegacyCloudMigration:
result = json.loads(bu_cli.browser_exec("print(1)"))
assert "autospawn:1" in result["output"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_explicit_backend_does_not_set_bu_autospawn(self, tmp_path, monkeypatch):
monkeypatch.setattr(
"hermes_cli.config.read_raw_config",
@@ -451,7 +451,7 @@ class TestBackendCdpResolution:
err = bu_cli._resolve_backend_cdp(self._env(), "t1")
assert err and "no" in err.lower() and "CDP" in err
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_named_session_composes_with_provider_backend(self, tmp_path, monkeypatch):
"""session=<name> composes with a configured provider backend: the
name keys its OWN provider browser (bu-named-<name>), so concurrent
@@ -537,7 +537,7 @@ class TestOwnTabPreamble:
monkeypatch.setattr(bu_cli, "_find_cli", lambda: [cli])
return json.loads(bu_cli.browser_exec("print('payload')", session=session))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_named_shared_browser_gets_preamble(self, tmp_path, monkeypatch):
result = self._run(tmp_path, monkeypatch, session="r7k2")
assert result["success"] is True
@@ -545,20 +545,20 @@ class TestOwnTabPreamble:
# model code still present, after the preamble
assert result["output"].index("_hermes_ensure_own_tab") < result["output"].index("print('payload')")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_unnamed_session_gets_no_preamble(self, tmp_path, monkeypatch):
result = self._run(tmp_path, monkeypatch, session="")
assert result["success"] is True
assert "_hermes_ensure_own_tab" not in result["output"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_named_provider_browser_skips_preamble(self, tmp_path, monkeypatch):
"""Per-name provider browsers are private — preamble would leak a tab."""
result = self._run(tmp_path, monkeypatch, session="r7k2", provider=True)
assert result["success"] is True
assert "_hermes_ensure_own_tab" not in result["output"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_sentinel_never_reaches_subprocess_env(self, tmp_path, monkeypatch):
import tools.browser_tool as bt
@@ -720,7 +720,7 @@ class TestNativeScreenshots:
out = f"{stale}\n/nonexistent/dir/x.png\n"
assert bu_cli._find_screenshot(out, since=time.time()) is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_vision_model_gets_multimodal_envelope(self, tmp_path, monkeypatch):
shot = self._shot(tmp_path)
cli = _fake_cli(tmp_path, f'cat > /dev/null\necho "{shot}"\n')
@@ -739,7 +739,7 @@ class TestNativeScreenshots:
assert result["meta"]["screenshot_path"] == shot
assert shot in result["text_summary"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_text_only_model_gets_plain_result_with_path(self, tmp_path, monkeypatch):
shot = self._shot(tmp_path)
cli = _fake_cli(tmp_path, f'cat > /dev/null\necho "{shot}"\n')
@@ -860,7 +860,7 @@ class TestBrowserExec:
result = json.loads(bu_cli.browser_exec(" "))
assert "error" in result
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_code_piped_on_stdin(self, tmp_path, monkeypatch):
cli = _fake_cli(tmp_path, 'code=$(cat)\necho "got:$code"\n')
monkeypatch.setattr(bu_cli, "_find_cli", lambda: [cli])
@@ -870,7 +870,7 @@ class TestBrowserExec:
assert 'got:print("hi")' in result["output"]
assert "session" not in result
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_session_sets_bu_name(self, tmp_path, monkeypatch):
cli = _fake_cli(tmp_path, 'cat > /dev/null\necho "bu:$BU_NAME"\n')
monkeypatch.setattr(bu_cli, "_find_cli", lambda: [cli])
@@ -885,7 +885,7 @@ class TestBrowserExec:
assert "error" in result
assert "session" in result["error"].lower()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_nonzero_exit_reports_failure_and_stderr(self, tmp_path, monkeypatch):
cli = _fake_cli(tmp_path, 'cat > /dev/null\necho "boom" >&2\nexit 3\n')
monkeypatch.setattr(bu_cli, "_find_cli", lambda: [cli])
@@ -894,7 +894,7 @@ class TestBrowserExec:
assert result["exit_code"] == 3
assert "boom" in result["stderr"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_timeout_returns_actionable_error(self, tmp_path, monkeypatch):
cli = _fake_cli(tmp_path, "cat > /dev/null\nsleep 30\n")
monkeypatch.setattr(bu_cli, "_find_cli", lambda: [cli])
@@ -915,7 +915,7 @@ class TestFindCliManagedBin:
monkeypatch.setenv("HERMES_HOME", str(tmp_path / "home"))
monkeypatch.setenv("PATH", str(tmp_path / "empty"))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_managed_bin_browser_use_found(self, tmp_path, monkeypatch):
bin_dir = tmp_path / "home" / "bin"
bin_dir.mkdir(parents=True)
@@ -924,7 +924,7 @@ class TestFindCliManagedBin:
bu.chmod(bu.stat().st_mode | stat.S_IXUSR)
assert bu_cli._find_cli_unpatched() == [str(bu)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_managed_bin_uvx_fallback(self, tmp_path, monkeypatch):
bin_dir = tmp_path / "home" / "bin"
bin_dir.mkdir(parents=True)
@@ -936,7 +936,7 @@ class TestFindCliManagedBin:
def test_nothing_found(self, tmp_path, monkeypatch):
assert bu_cli._find_cli_unpatched() is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_user_local_bin_browser_use_found(self, tmp_path, monkeypatch):
"""#83788: Desktop/TUI workers spawn with a minimal PATH that omits
~/.local/bin, where `uv tool install browser-use` links the binary
@@ -948,7 +948,7 @@ class TestFindCliManagedBin:
cli.chmod(cli.stat().st_mode | stat.S_IXUSR)
assert bu_cli._find_cli_unpatched() == [str(cli)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_managed_bin_precedes_user_local_bin(self, tmp_path, monkeypatch):
"""MANAGED-FIRST: Hermes' managed copy wins over a user-level side
install — every backend selection provisions/updates the managed
@@ -966,7 +966,7 @@ class TestFindCliManagedBin:
managed_cli.chmod(managed_cli.stat().st_mode | stat.S_IXUSR)
assert bu_cli._find_cli_unpatched() == [str(managed_cli)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_managed_bin_precedes_path(self, tmp_path, monkeypatch):
"""MANAGED-FIRST: the managed copy also wins over one on PATH."""
path_dir = tmp_path / "onpath"
@@ -982,7 +982,7 @@ class TestFindCliManagedBin:
managed_cli.chmod(managed_cli.stat().st_mode | stat.S_IXUSR)
assert bu_cli._find_cli_unpatched() == [str(managed_cli)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_user_local_bin_uvx_fallback(self, tmp_path, monkeypatch):
cli_dir = tmp_path / "userhome" / ".local" / "bin"
cli_dir.mkdir(parents=True)
@@ -1011,7 +1011,7 @@ class TestInstallCli:
assert ok is False
assert "already installed" not in msg
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_already_installed_in_managed_bin(self, tmp_path, monkeypatch):
bin_dir = tmp_path / "home" / "bin"
bin_dir.mkdir(parents=True)
@@ -1036,7 +1036,7 @@ class TestInstallCli:
assert ok is False
assert "uv" in msg
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_successful_install_via_fake_uv(self, tmp_path, monkeypatch):
home = tmp_path / "home"
bin_dir = home / "bin"
@@ -1065,7 +1065,7 @@ class TestInstallCli:
assert ok is True, msg
assert (bin_dir / "browser-use").exists()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_failed_install_surfaces_stderr_tail(self, tmp_path, monkeypatch):
home = tmp_path / "home"
monkeypatch.setenv("HERMES_HOME", str(home))
diff --git a/tests/tools/test_clipboard.py b/tests/tools/test_clipboard.py
index 6e08d7f9bb7..eca303661cf 100644
--- a/tests/tools/test_clipboard.py
+++ b/tests/tools/test_clipboard.py
@@ -402,7 +402,7 @@ class TestHasClipboardImage:
import hermes_cli.clipboard as cb
cb._wsl_detected = None
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_macos_dispatch(self):
"""Faking darwin selected the branch but left `_macos_has_image`'s real
facility (osascript) absent — only a real macOS host has it."""
@@ -410,7 +410,7 @@ class TestHasClipboardImage:
assert has_clipboard_image() is True
m.assert_called_once()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_wsl_falls_through_to_wayland_when_windows_path_empty(self):
"""WSLg often bridges images to wl-paste even when powershell.exe check fails.
diff --git a/tests/tools/test_code_execution.py b/tests/tools/test_code_execution.py
index 7fe33261c52..1a82344bf7e 100644
--- a/tests/tools/test_code_execution.py
+++ b/tests/tools/test_code_execution.py
@@ -905,7 +905,7 @@ class TestRpcTokenAuthorization(unittest.TestCase):
t.join(timeout=5)
return responses
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_missing_token_rejected(self):
"""A request with no token is rejected as Unauthorized."""
resp = self._drive_server(
diff --git a/tests/tools/test_code_execution_windows_env.py b/tests/tools/test_code_execution_windows_env.py
index 45d0058f4bd..d5c57642f47 100644
--- a/tests/tools/test_code_execution_windows_env.py
+++ b/tests/tools/test_code_execution_windows_env.py
@@ -191,11 +191,11 @@ class TestScrubChildEnvPassthroughInteraction:
assert "OPENAI_API_KEY" not in scrubbed
-# ``windows_only`` rather than ``skipif(sys.platform != "win32")``: the
+# ``platforms("windows")`` rather than ``skipif(sys.platform != "win32")``: the
# dedicated Windows CI job selects its files by grepping for the marker, so a
# bare skipif is invisible to it — the file is never imported there and these
# tests run on no host at all.
class TestWindowsSocketSmokeTest:
"""Integration-ish smoke test: spawn a child Python with a scrubbed
env and confirm it can create an AF_INET socket. This is the
@@ -480,7 +480,7 @@ class TestSandboxWritesUtf8:
finally:
os.unlink(tmp_path)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_default_encoding_would_have_failed(self):
"""Negative control: prove that on Windows, writing the stub
*without* ``encoding="utf-8"`` would corrupt the file. If this
@@ -614,7 +614,7 @@ class TestChildStdioIsUtf8:
assert "\u2192" in decoded, f"arrow missing from output: {decoded!r}"
assert "\U0001f680" in decoded, f"emoji missing from output: {decoded!r}"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_child_without_utf8_env_would_fail(self):
"""Negative control: spawn a Python child *without* our env
overrides and prove that on Windows, printing non-ASCII fails.
diff --git a/tests/tools/test_computer_use_cua_backend_linux.py b/tests/tools/test_computer_use_cua_backend_linux.py
index f106ea14f08..43ad30050f1 100644
--- a/tests/tools/test_computer_use_cua_backend_linux.py
+++ b/tests/tools/test_computer_use_cua_backend_linux.py
@@ -85,7 +85,7 @@ def test_parse_xprop_net_active_window_standard_output():
assert _parse_xprop_net_active_window(raw) == 0x503000b
def test_default_capture_prefers_x11_active_window_when_z_index_tied():
"""The ``_NET_ACTIVE_WINDOW`` tie-break is a Linux/X11-only branch of
``_select_capture_target``; run it where ``sys.platform`` really is
@@ -104,7 +104,7 @@ def test_default_capture_prefers_x11_active_window_when_z_index_tied():
assert target["window_id"] == 84043449
def test_default_capture_skips_desktop_helper_when_active_window_unknown():
"""Even without _NET_ACTIVE_WINDOW, ding/Desktop helpers must not win (#54173).
diff --git a/tests/tools/test_docker_environment.py b/tests/tools/test_docker_environment.py
index e92a005b7b9..6998026f0f7 100644
--- a/tests/tools/test_docker_environment.py
+++ b/tests/tools/test_docker_environment.py
@@ -620,7 +620,7 @@ def _bind_mount_specs(run_args):
]
def test_persistent_bind_mounts_survive_a_session_key_task_id(monkeypatch, tmp_path):
"""A gateway session key reaches the persistent sandbox path as-is, and it
carries colons (``session:agent:main:telegram:dm:<chat_id>``). Docker reads
diff --git a/tests/tools/test_execution_flag_detection.py b/tests/tools/test_execution_flag_detection.py
index 7cd9cc9c6a6..27f28fc8ba2 100644
--- a/tests/tools/test_execution_flag_detection.py
+++ b/tests/tools/test_execution_flag_detection.py
@@ -19,7 +19,7 @@ from tools.approval import detect_dangerous_command, detect_hardline_command
(["rg", "--pre-glob", "--pre", "needle"], "needle\n", 0, "needle\n"),
],
)
def test_real_read_tool_binaries_confirm_option_ownership(
argv, stdin, expected_returncode, expected_output
):
@@ -44,7 +44,7 @@ def test_real_read_tool_binaries_confirm_option_ownership(
("man", ["-P", "-payload-marker", "ls"], None, True),
],
)
def test_real_binaries_execute_leading_dash_program_payload(
tmp_path, tool, args, stdin, needs_tty
):
diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.py
index c596faf9d48..1da54771992 100644
--- a/tests/tools/test_file_operations.py
+++ b/tests/tools/test_file_operations.py
@@ -286,7 +286,7 @@ class TestShellFileOpsHelpers:
assert file_ops._escape_shell_arg("hello") == "'hello'"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_escape_shell_arg_rewrites_forward_slash_native_paths(self, file_ops):
"""Windows-only: ``_bash_safe_path`` only rewrites drive paths to the
Git Bash form on Windows, where the MSYS path mangling it works around
@@ -295,7 +295,7 @@ class TestShellFileOpsHelpers:
"C:/Users/alice/notes.txt"
) == "'/c/Users/alice/notes.txt'"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_read_file_uses_bash_safe_windows_paths(self, mock_env):
"""Windows-only: proves read_file's shell commands carry the MSYS path
form Git Bash needs — a translation that is a no-op off Windows."""
@@ -439,7 +439,7 @@ class TestSearchFilesFallbackHiddenPaths:
def _make_env(self):
return make_real_subprocess_env("/")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_hidden_root_with_hidden_ancestor_includes_files(self, tmp_path, monkeypatch):
"""Fallback find should include visible files when path is inside hidden root."""
root = tmp_path / ".hermes" / "logs"
@@ -460,7 +460,7 @@ class TestSearchFilesFallbackHiddenPaths:
assert result.error is None
assert set(result.files) == {str(visible_file), str(visible_nested_file)}
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_normal_root_still_excludes_hidden_descendants(self, tmp_path, monkeypatch):
"""Fallback find should still exclude hidden descendant paths for normal roots."""
root = tmp_path / "repo"
@@ -592,7 +592,7 @@ class TestAtomicWriteNewFilePermissions:
"""_atomic_write should apply umask-default perms to new files (not 0600)."""
@pytest.mark.parametrize("test_umask", [0o022, 0o002, 0o077])
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_new_file_gets_umask_default_permissions(self, tmp_path, test_umask):
"""Newly created file should get umask-computed perms, not mktemp's 0600.
@@ -617,7 +617,7 @@ class TestAtomicWriteNewFilePermissions:
f"got {actual_mode:04o}"
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_overwrite_still_preserves_existing_mode(self, tmp_path):
"""The new-file branch must not disturb the overwrite path's
mode preservation (e.g. an executable script stays 0755)."""
diff --git a/tests/tools/test_file_ops_cwd_tracking.py b/tests/tools/test_file_ops_cwd_tracking.py
index 13ef03c997a..4436a15c183 100644
--- a/tests/tools/test_file_ops_cwd_tracking.py
+++ b/tests/tools/test_file_ops_cwd_tracking.py
@@ -107,7 +107,7 @@ class TestShellFileOpsCwdTracking:
assert result.exit_code == 0
assert "fixed-content" in result.stdout
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_patch_returns_success_only_when_file_actually_written(self, tmp_path):
"""Safety rail: patch_replace success must reflect the real file state.
diff --git a/tests/tools/test_file_read_guards.py b/tests/tools/test_file_read_guards.py
index 4d154615152..492f22f36ab 100644
--- a/tests/tools/test_file_read_guards.py
+++ b/tests/tools/test_file_read_guards.py
@@ -67,7 +67,7 @@ def _make_safe_tempdir(prefix: str) -> str:
class TestDevicePathBlocking(unittest.TestCase):
"""Paths like /dev/zero should be rejected before any I/O."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_blocked_device_detection(self):
for dev in ("/dev/zero", "/dev/random", "/dev/urandom", "/dev/stdin",
"/dev/tty", "/dev/console", "/dev/stdout", "/dev/stderr",
@@ -78,7 +78,7 @@ class TestDevicePathBlocking(unittest.TestCase):
self.assertFalse(_is_blocked_device("/dev/null"))
self.assertFalse(_is_blocked_device("/dev/sda1"))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_proc_fd_blocked(self):
self.assertTrue(_is_blocked_device("/proc/self/fd/0"))
self.assertTrue(_is_blocked_device("/proc/12345/fd/2"))
@@ -95,7 +95,7 @@ class TestDevicePathBlocking(unittest.TestCase):
self.assertFalse(_is_blocked_device_path("/proc/self/fd/3"))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_proc_sensitive_pseudo_files_blocked(self):
"""environ/cmdline/maps (and maps variants) under /proc/<pid> must be blocked (issue #4427)."""
for path in (
@@ -120,7 +120,7 @@ class TestDevicePathBlocking(unittest.TestCase):
):
self.assertTrue(_is_blocked_device(path), f"{path} should be blocked")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_proc_task_thread_sensitive_files_blocked(self):
"""Per-thread /proc/<pid>/task/<tid>/<file> aliases leak the same data."""
for path in (
@@ -137,7 +137,7 @@ class TestDevicePathBlocking(unittest.TestCase):
for path in ("/proc/cpuinfo", "/proc/meminfo", "/proc/uptime", "/proc/version"):
self.assertFalse(_is_blocked_device(path), f"{path} should not be blocked")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_normpath_alias_to_blocked_device_is_blocked(self):
self.assertTrue(_is_blocked_device("/dev/../dev/zero"))
self.assertTrue(_is_blocked_device("/dev/./urandom"))
@@ -168,7 +168,7 @@ class TestDevicePathBlocking(unittest.TestCase):
self.assertFalse(_is_blocked_device(link_path))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_read_file_tool_rejects_device(self):
"""read_file_tool returns an error without any file I/O."""
result = json.loads(read_file_tool("/dev/zero", task_id="dev_test"))
diff --git a/tests/tools/test_file_sync.py b/tests/tools/test_file_sync.py
index 7514ee7aab6..f6d737c1371 100644
--- a/tests/tools/test_file_sync.py
+++ b/tests/tools/test_file_sync.py
@@ -264,7 +264,7 @@ class TestEdgeCases:
class TestConcurrency:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_sync_back_waits_for_active_sync_transaction(self, tmp_path):
initial_file = tmp_path / "initial.png"
new_file = tmp_path / "new.png"
@@ -318,7 +318,7 @@ class TestConcurrency:
class TestSyncBackSecurity:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_sync_back_does_not_overwrite_uploaded_credential_files(self, tmp_path, monkeypatch):
credential = tmp_path / "token.json"
credential.write_text("host-token", encoding="utf-8")
diff --git a/tests/tools/test_file_tools.py b/tests/tools/test_file_tools.py
index c234b759a6a..387737cf440 100644
--- a/tests/tools/test_file_tools.py
+++ b/tests/tools/test_file_tools.py
@@ -44,7 +44,7 @@ class TestReadFileHandler:
class TestWriteFileHandler:
@patch("tools.file_tools._get_file_ops")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_writes_content(self, mock_get):
mock_ops = MagicMock()
result_obj = MagicMock()
@@ -133,7 +133,7 @@ class TestWriteFileHandler:
class TestPatchHandler:
@patch("tools.file_tools._get_file_ops")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_replace_mode_calls_patch_replace(self, mock_get):
mock_ops = MagicMock()
result_obj = MagicMock()
@@ -227,7 +227,7 @@ class TestPatchSensitivePathExtraction:
"""
@patch("tools.file_tools._get_file_ops")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_patch_move_to_sensitive_dst_blocked(self, mock_get):
from tools.file_tools import patch_tool
patch_text = (
@@ -242,7 +242,7 @@ class TestPatchSensitivePathExtraction:
@patch("tools.file_tools._get_file_ops")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_patch_update_no_space_after_asterisks_blocked(self, mock_get):
"""``***Update File:`` (no space after asterisks) must also be caught.
@@ -316,7 +316,7 @@ class TestSearchHandler:
class TestWindowsMsysPathResolution:
"""File tools must translate Git Bash drive paths before Path resolution."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_absolute_msys_path_normalized_before_windows_resolve(self, monkeypatch):
"""Windows-only: ``_resolve_path_for_task`` hands the translated path
to ``ntpath``/``Path``, and only a real Windows ``Path`` renders
@@ -329,7 +329,7 @@ class TestWindowsMsysPathResolution:
assert str(resolved) == r"C:\Users\Mark\project\app.py"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_container_paths_skip_msys_translation(self, monkeypatch):
"""WSL/docker Linux paths must not be rewritten as Windows drives.
@@ -459,7 +459,7 @@ class TestSensitivePathCheck:
assert "Hermes config" in result["error"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_system_path_still_blocked(self, monkeypatch):
monkeypatch.setattr("tools.file_tools._hermes_config_resolved", "/some/other/path")
monkeypatch.setattr("tools.file_tools._hermes_config_resolved_loaded", True)
@@ -469,7 +469,7 @@ class TestSensitivePathCheck:
assert "error" in result
assert "sensitive system path" in result["error"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_macos_private_var_carveouts(self):
"""macOS temp dirs under /private/var must not be blanket-blocked,
while the genuinely-sensitive /private/var subtrees still are."""
diff --git a/tests/tools/test_file_tools_live.py b/tests/tools/test_file_tools_live.py
index b67ae5e935c..42a51c03566 100644
--- a/tests/tools/test_file_tools_live.py
+++ b/tests/tools/test_file_tools_live.py
@@ -98,7 +98,7 @@ class TestLocalEnvironmentExecute:
_assert_clean(result["output"])
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cat_deterministic_content(self, env, tmp_path):
f = tmp_path / "det.txt"
f.write_text(SIMPLE_CONTENT)
@@ -226,7 +226,7 @@ class TestSearch:
# ── _expand_path ─────────────────────────────────────────────────────────
class TestExpandPath:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_tilde_exact(self, ops):
result = ops._expand_path("~/test.txt")
expected = f"{Path.home()}/test.txt"
@@ -263,7 +263,7 @@ class TestTerminalOutputCleanliness:
assert result["output"].strip() == "CLEAN_TEST"
_assert_clean(result["output"])
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cat(self, env, tmp_path):
f = tmp_path / "cat_test.txt"
f.write_text("CAT_CONTENT_EXACT\n")
diff --git a/tests/tools/test_file_tools_tilde_profile.py b/tests/tools/test_file_tools_tilde_profile.py
index 40bfa6b61a2..93fb3cbb910 100644
--- a/tests/tools/test_file_tools_tilde_profile.py
+++ b/tests/tools/test_file_tools_tilde_profile.py
@@ -31,7 +31,7 @@ import tools.terminal_tool as terminal_tool
class TestExpandTilde:
"""Verify the _expand_tilde() helper resolves ~ to the profile home."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_tilde_expands_to_profile_home(self):
"""When get_subprocess_home returns a value, ~/path uses it."""
with patch("hermes_constants.get_subprocess_home", return_value="/opt/data/profiles/coder/home"):
diff --git a/tests/tools/test_file_write_safety.py b/tests/tools/test_file_write_safety.py
index 866882769a8..e5b29972f75 100644
--- a/tests/tools/test_file_write_safety.py
+++ b/tests/tools/test_file_write_safety.py
@@ -232,27 +232,27 @@ class TestSafeRootDenialMessageIntegration:
class TestCheckSensitivePathMacOSBypass:
"""Verify _check_sensitive_path blocks /private/etc paths (issue #8734)."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_etc_hosts_blocked(self):
from tools.file_tools import _check_sensitive_path
assert _check_sensitive_path("/etc/hosts") is not None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_private_etc_hosts_blocked(self):
from tools.file_tools import _check_sensitive_path
assert _check_sensitive_path("/private/etc/hosts") is not None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_private_etc_ssh_config_blocked(self):
from tools.file_tools import _check_sensitive_path
assert _check_sensitive_path("/private/etc/ssh/sshd_config") is not None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_private_var_blocked(self):
from tools.file_tools import _check_sensitive_path
assert _check_sensitive_path("/private/var/db/something") is not None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_boot_still_blocked(self):
from tools.file_tools import _check_sensitive_path
assert _check_sensitive_path("/boot/grub/grub.cfg") is not None
@@ -296,7 +296,7 @@ class TestAtomicWrite:
assert [p for p in os.listdir(tmp_path) if ".hermes-tmp" in p] == []
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_patch_routes_through_atomic_write(self, ops, tmp_path: Path):
target = tmp_path / "edit.py"
target.write_text("a = 1\nb = 2\nc = 3\n", encoding="utf-8")
diff --git a/tests/tools/test_find_shell.py b/tests/tools/test_find_shell.py
index 0baab55e325..2947d4069f1 100644
--- a/tests/tools/test_find_shell.py
+++ b/tests/tools/test_find_shell.py
@@ -18,7 +18,7 @@ from tools.environments.local import _find_bash, _find_shell
class TestFindShellPrefersUserShell:
"""_find_shell should prefer $SHELL over bash on POSIX."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_returns_shell_env_when_set_and_exists(self, tmp_path):
"""When $SHELL points to an existing allowlisted executable, _find_shell returns it."""
fake_zsh = tmp_path / "zsh"
@@ -47,7 +47,7 @@ class TestFindShellPrefersUserShell:
assert _find_shell() == _find_bash()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_honours_allowlisted_bash_and_dash(self, tmp_path):
"""Every allowlisted POSIX-sh-family shell is honoured."""
for name in ("bash", "dash", "sh", "ksh"):
@@ -67,7 +67,7 @@ class TestFindShellPrefersUserShell:
class TestFindShellWindowsBehavior:
"""On Windows, _find_shell always delegates to _find_bash."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_ignores_shell_env(self):
"""On Windows, $SHELL is ignored — _find_shell delegates to _find_bash.
@@ -107,7 +107,7 @@ class TestFindBashUnchanged:
class TestFindBashSkipsBrokenCustomPath:
"""Stale HERMES_GIT_BASH_PATH must not brick Windows terminal startup."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_falls_through_to_portable_when_custom_fails_probe(self, tmp_path, monkeypatch):
"""Windows-only: the candidate ladder (HERMES_GIT_BASH_PATH →
%LOCALAPPDATA%\\hermes\\git → Program Files) only exists in
@@ -156,7 +156,7 @@ class TestGitBashExternalProgramProbe:
assert local_mod._bash_starts(r"C:\Git\bin\bash.exe") is True
assert calls[0][0][-1] == "/usr/bin/true; /usr/bin/cat --version >/dev/null"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_aslr_failure_surfaces_targeted_windows_command(
self, tmp_path, monkeypatch
):
@@ -195,7 +195,7 @@ class TestGitBashExternalProgramProbe:
assert str(tmp_path / "hermes" / "git") in message
@pytest.mark.skipif(
not os.path.isfile("/bin/bash"),
reason="reproduces the macOS system-bash-3.2 login-shell swallow",
diff --git a/tests/tools/test_interrupted_command_cwd.py b/tests/tools/test_interrupted_command_cwd.py
index 39c1ff7e8c2..630874b66fd 100644
--- a/tests/tools/test_interrupted_command_cwd.py
+++ b/tests/tools/test_interrupted_command_cwd.py
@@ -58,7 +58,7 @@ class TestCwdObservedFlag:
result, _ = _run(env, "sess", f"cd {target} && pwd")
assert result["cwd_observed"] is True
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_interrupted_command_reports_no_cwd(self, env, tmp_path):
target = tmp_path / "slow"
target.mkdir()
@@ -68,7 +68,7 @@ class TestCwdObservedFlag:
class TestInterruptDoesNotStealAnotherSessionsCwd:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_record_survives_an_interrupt(self, env, tmp_path):
mine = tmp_path / "mine"
theirs = tmp_path / "theirs"
@@ -86,7 +86,7 @@ class TestInterruptDoesNotStealAnotherSessionsCwd:
_run(env, "mine", f"cd {mine} && sleep 20", timeout=2)
assert tt.get_session_cwd("mine") == str(mine)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_next_command_still_runs_in_my_directory(self, env, tmp_path):
mine = tmp_path / "mine"
theirs = tmp_path / "theirs"
@@ -100,7 +100,7 @@ class TestInterruptDoesNotStealAnotherSessionsCwd:
result, _ = _run(env, "mine", "pwd")
assert os.path.realpath(result["output"].strip()) == os.path.realpath(str(mine))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_single_session_keeps_its_own_prior_directory(self, env, tmp_path):
"""No second session needed: a lone session must not re-home either."""
first = tmp_path / "first"
@@ -171,7 +171,7 @@ class TestTerminalToolReadsTheFlag:
tt.terminal_tool(command=command, task_id=task_id, timeout=timeout)
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_interrupt_keeps_record_and_echoes_no_cwd(self, env, tmp_path, monkeypatch):
mine = tmp_path / "mine"
theirs = tmp_path / "theirs"
@@ -199,7 +199,7 @@ class TestTerminalToolReadsTheFlag:
# my command_cwd (mine), so the echo would fire with THEIR directory.
assert "cwd" not in result or result.get("cwd") is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_completed_command_still_records_and_echoes(self, env, tmp_path, monkeypatch):
"""The gate must not break the observed path: cd still round-trips."""
target = tmp_path / "target"
diff --git a/tests/tools/test_lazy_deps.py b/tests/tools/test_lazy_deps.py
index 74838a69a38..1da1d307272 100644
--- a/tests/tools/test_lazy_deps.py
+++ b/tests/tools/test_lazy_deps.py
@@ -350,7 +350,7 @@ class TestRefreshActiveFeatures:
assert result["platform.matrix"].startswith("skipped:")
assert "unsupported on Windows" in result["platform.matrix"]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_matrix_probe_reports_unsupported_on_real_windows(self):
# The probe itself keys off the real host: patching sys.platform only
# proved the string, never that Windows actually hits this gate.
diff --git a/tests/tools/test_lazy_deps_durable_target.py b/tests/tools/test_lazy_deps_durable_target.py
index 45dcc7477ee..91ee19f8ff7 100644
--- a/tests/tools/test_lazy_deps_durable_target.py
+++ b/tests/tools/test_lazy_deps_durable_target.py
@@ -91,7 +91,7 @@ class TestAbiStamp:
assert stamp.read_text().strip() == ld._python_abi_tag()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_readonly_target_reports_error(self, tmp_path):
# A path under a non-writable parent should surface a clean error,
# not raise.
diff --git a/tests/tools/test_local_background_child_hang.py b/tests/tools/test_local_background_child_hang.py
index 54fd896ce15..539e2b11157 100644
--- a/tests/tools/test_local_background_child_hang.py
+++ b/tests/tools/test_local_background_child_hang.py
@@ -70,7 +70,7 @@ class TestBackgroundChildDoesNotHang:
_pkill("time.sleep(60)")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_default_capture_is_full_fidelity_for_internal_consumers(
self, local_env
):
@@ -97,7 +97,7 @@ class TestBackgroundChildDoesNotHang:
assert len(result["output"]) > 200000
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_utf8_multibyte_across_read_boundary(self, local_env):
"""Multibyte UTF-8 characters straddling a 4096-byte ``os.read()`` boundary
must be decoded correctly via the incremental decoder — not lost to a
@@ -123,7 +123,7 @@ class TestBackgroundChildDoesNotHang:
# And the "[binary output detected ...]" fallback must NOT fire
assert "binary output detected" not in result["output"]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_invalid_utf8_uses_replacement_not_fallback(self, local_env):
"""Truly invalid byte sequences must be substituted with U+FFFD (matching
the pre-fix ``errors='replace'`` behaviour of the old ``TextIOWrapper``
diff --git a/tests/tools/test_local_env_blocklist.py b/tests/tools/test_local_env_blocklist.py
index 5cae08330b5..91dd7a0e184 100644
--- a/tests/tools/test_local_env_blocklist.py
+++ b/tests/tools/test_local_env_blocklist.py
@@ -764,7 +764,7 @@ class TestPythonpathSelectiveStrip:
assert hermes_win in entries
assert user_win in entries
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_hermes_owned_paths_stripped(self):
"""On Windows, a Hermes venv site-packages entry written with
backslashes is stripped by the same Hermes-owned check, while a
@@ -1590,7 +1590,7 @@ class TestSanePathIncludesHomebrew:
assert entry in path_entries
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_make_run_env_real_launchd_path_gains_homebrew(self):
"""The literal macOS launchd PATH is the production trigger for #35613.
@@ -1608,7 +1608,7 @@ class TestSanePathIncludesHomebrew:
assert path_entries[:4] == ["/usr/bin", "/bin", "/usr/sbin", "/sbin"]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_make_run_env_preserves_windows_mixed_case_path_key(self, monkeypatch):
"""Windows-only: ``_path_env_key`` looks for a case-insensitive PATH
key only on Windows, so the mixed-case ``Path`` preservation this
diff --git a/tests/tools/test_local_env_cwd_recovery.py b/tests/tools/test_local_env_cwd_recovery.py
index 3093eb5261b..6e2069ce2db 100644
--- a/tests/tools/test_local_env_cwd_recovery.py
+++ b/tests/tools/test_local_env_cwd_recovery.py
@@ -29,7 +29,7 @@ class TestResolveSafeCwd:
assert _resolve_safe_cwd(path) == path
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_returns_root_when_only_root_exists(self, monkeypatch):
"""If every ancestor except the filesystem root is gone, the root
itself is still a valid recovery target — don't skip it just because
diff --git a/tests/tools/test_local_env_relative_cwd.py b/tests/tools/test_local_env_relative_cwd.py
index d7ec6e2a0f6..f55e4c0d9f2 100644
--- a/tests/tools/test_local_env_relative_cwd.py
+++ b/tests/tools/test_local_env_relative_cwd.py
@@ -14,7 +14,7 @@ def test_relative_initial_cwd_resolves_from_parent(tmp_path, monkeypatch):
assert _resolve_local_initial_cwd("hermes-agent") == str(project)
def test_local_environment_keeps_existing_relative_child_cwd(tmp_path, monkeypatch):
project = tmp_path / "hermes-agent"
project.mkdir()
diff --git a/tests/tools/test_local_env_windows_msys.py b/tests/tools/test_local_env_windows_msys.py
index 79a3edff0e7..853d47e4d16 100644
--- a/tests/tools/test_local_env_windows_msys.py
+++ b/tests/tools/test_local_env_windows_msys.py
@@ -23,9 +23,9 @@ False *on Windows*, and the fake had to recreate that condition by hand
on a host where the path semantics, the drive letters, the path
separator, and Git Bash itself are all absent.
-So the Windows-behaviour tests are ``windows_only`` and run on the
+So the Windows-behaviour tests are ``platforms("windows")`` and run on the
Windows CI job against a real Git Bash layout. The "no-op off Windows"
-cases assert genuine POSIX behaviour and are ``linux_only`` — on that
+cases assert genuine POSIX behaviour and are ``platforms("linux")`` — on that
host ``_IS_WINDOWS`` is already False, so no patching is needed at all.
"""
@@ -56,19 +56,19 @@ from tools.environments.local import (
# ---------------------------------------------------------------------------
class TestMsysToWindowsPath:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_noop_on_non_windows(self):
# On a non-Windows host the function must never rewrite the path
# — POSIX-style paths are real paths there.
assert _msys_to_windows_path("/c/Users/NVIDIA") == "/c/Users/NVIDIA"
assert _msys_to_windows_path("/home/teknium") == "/home/teknium"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_translates_drive_path(self):
assert _msys_to_windows_path("/c/Users/NVIDIA") == r"C:\Users\NVIDIA"
assert _msys_to_windows_path("/d/Projects/foo bar") == r"D:\Projects\foo bar"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_empty_string(self):
assert _msys_to_windows_path("") == ""
@@ -78,11 +78,11 @@ class TestMsysToWindowsPath:
# ---------------------------------------------------------------------------
class TestWindowsToMsysPath:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_noop_on_non_windows(self):
assert _windows_to_msys_path(r"C:\Users\NVIDIA") == r"C:\Users\NVIDIA"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_does_not_translate_non_drive_path(self):
assert _windows_to_msys_path("/tmp/foo") == "/tmp/foo"
assert _windows_to_msys_path(r"\\server\share") == r"\\server\share"
@@ -92,7 +92,7 @@ class TestWindowsToMsysPath:
# _bash_safe_path / _quote_bash_path — shell-script interpolation
# ---------------------------------------------------------------------------
class TestBashSafePath:
def test_native_windows_path_becomes_msys(self):
assert _bash_safe_path(r"C:\Users\alice\notes.txt") == "/c/Users/alice/notes.txt"
@@ -109,7 +109,7 @@ class TestBashSafePath:
# _resolve_safe_cwd — Windows fast path
# ---------------------------------------------------------------------------
class TestResolveSafeCwdWindows:
def test_msys_path_resolves_to_native_when_native_exists(self, tmp_path):
"""The whole point of this fix: a Git Bash ``/c/Users/x`` value
@@ -130,7 +130,7 @@ class TestResolveSafeCwdWindows:
# End-to-end: _update_cwd via stdout marker
# ---------------------------------------------------------------------------
class TestUpdateCwdWindowsMsys:
def test_marker_output_msys_path_stored_in_native_form(self, tmp_path):
"""When Git Bash emits ``/c/Users/x`` in the cwd marker on Windows,
@@ -166,7 +166,7 @@ class TestUpdateCwdWindowsMsys:
# End-to-end: _extract_cwd_from_output rollback when marker is invalid
# ---------------------------------------------------------------------------
class TestExtractCwdFromOutputWindowsMsys:
def test_stale_msys_marker_does_not_clobber_cwd(self, tmp_path):
"""When the cwd marker in stdout points at a non-existent path,
@@ -218,7 +218,7 @@ class TestExtractCwdFromOutputWindowsMsys:
# MSYS_NO_PATHCONV — native Windows command flags (#56700)
# ---------------------------------------------------------------------------
class TestWindowsMsysPathconvDefaults:
def test_make_run_env_sets_msys_no_pathconv_on_windows(self):
run_env = _make_run_env({})
@@ -247,7 +247,7 @@ class TestGitBashCoreutilsOnPath:
existing = {e.replace("\\", "/") for e in existing}
return lambda p: p.replace("\\", "/") in existing
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_derives_dirs_from_portablegit_layout(self, monkeypatch):
"""The PortableGit layout probe, run on the real OS.
@@ -277,12 +277,12 @@ class TestGitBashCoreutilsOnPath:
# Non-existent dirs (mingw32, usr/local/bin) are excluded.
assert "/pg/mingw32/bin" not in norm
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_empty_off_windows(self, monkeypatch):
monkeypatch.setattr(local_mod, "_git_bash_bin_dirs_cache", None)
assert _git_bash_bin_dirs() == []
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_make_run_env_noop_on_posix(self, monkeypatch):
monkeypatch.setattr(local_mod, "_git_bash_bin_dirs_cache", None)
run_env = _make_run_env({"PATH": "/usr/bin:/bin"})
@@ -294,7 +294,7 @@ class TestGitBashCoreutilsOnPath:
# Command wrapping — native Windows cwd must be Git Bash-friendly for cd
# ---------------------------------------------------------------------------
class TestWrapCommandWindowsNativeCwd:
def test_wrap_command_converts_native_cwd_for_builtin_cd(self):
with patch.object(
diff --git a/tests/tools/test_local_interrupt_cleanup.py b/tests/tools/test_local_interrupt_cleanup.py
index 46ebd27c273..9946406c6fc 100644
--- a/tests/tools/test_local_interrupt_cleanup.py
+++ b/tests/tools/test_local_interrupt_cleanup.py
@@ -65,7 +65,7 @@ def _wait_for_pgid_exit(pgid: int, timeout: float = 60.0) -> bool:
return not _pgid_still_alive(pgid)
def test_kill_process_uses_cached_pgid_if_wrapper_already_exited(monkeypatch):
"""If the shell wrapper exits before cleanup, still kill its process group.
@@ -98,7 +98,7 @@ def test_kill_process_uses_cached_pgid_if_wrapper_already_exited(monkeypatch):
assert killpg_calls == [(67890, signal.SIGTERM), (67890, 0)]
def test_wait_for_process_kills_subprocess_on_keyboardinterrupt():
"""When KeyboardInterrupt arrives mid-poll, the subprocess group must be
killed before the exception is re-raised."""
diff --git a/tests/tools/test_local_setsid_descendant_sweep.py b/tests/tools/test_local_setsid_descendant_sweep.py
index b43dee6fc1a..0ad18ddd896 100644
--- a/tests/tools/test_local_setsid_descendant_sweep.py
+++ b/tests/tools/test_local_setsid_descendant_sweep.py
@@ -17,7 +17,7 @@ from types import SimpleNamespace
import pytest
-pytestmark = pytest.mark.linux_only
+pytestmark = pytest.mark.platforms("linux")
from tools.environments.local import LocalEnvironment
diff --git a/tests/tools/test_local_shell_init.py b/tests/tools/test_local_shell_init.py
index e0c3907b93c..335777aa19b 100644
--- a/tests/tools/test_local_shell_init.py
+++ b/tests/tools/test_local_shell_init.py
@@ -19,7 +19,7 @@ from tools.environments.local import (
class TestResolveShellInitFiles:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_auto_sources_bashrc_when_present(self, tmp_path, monkeypatch):
bashrc = tmp_path / ".bashrc"
bashrc.write_text('export MARKER=seen\n')
@@ -34,7 +34,7 @@ class TestResolveShellInitFiles:
assert resolved == [str(bashrc)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_auto_sources_profile_when_present(self, tmp_path, monkeypatch):
"""~/.profile is where ``n`` / ``nvm`` installers typically write
their PATH export on Debian/Ubuntu, and it has no interactivity
@@ -53,7 +53,7 @@ class TestResolveShellInitFiles:
assert resolved == [str(profile)]
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_auto_sources_profile_before_bashrc(self, tmp_path, monkeypatch):
"""Both files present: profile runs first so PATH exports in
profile take effect even if bashrc short-circuits on the
diff --git a/tests/tools/test_local_tempdir.py b/tests/tools/test_local_tempdir.py
index 04c0776afba..93377ff90a2 100644
--- a/tests/tools/test_local_tempdir.py
+++ b/tests/tools/test_local_tempdir.py
@@ -5,7 +5,7 @@ import pytest
class TestLocalTempDir:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_uses_os_tmpdir_for_session_artifacts(self, monkeypatch):
monkeypatch.setenv("TMPDIR", "/data/data/com.termux/files/usr/tmp")
monkeypatch.delenv("TMP", raising=False)
@@ -19,7 +19,7 @@ class TestLocalTempDir:
assert env._cwd_file == f"/data/data/com.termux/files/usr/tmp/hermes-cwd-{env._session_id}.txt"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_falls_back_to_tempfile_when_tmp_missing(self, monkeypatch):
monkeypatch.delenv("TMPDIR", raising=False)
monkeypatch.delenv("TMP", raising=False)
diff --git a/tests/tools/test_mcp_schema_cache.py b/tests/tools/test_mcp_schema_cache.py
index 5e21ad4c03d..6f0c6e35477 100644
--- a/tests/tools/test_mcp_schema_cache.py
+++ b/tests/tools/test_mcp_schema_cache.py
@@ -77,7 +77,7 @@ class TestCacheRoundTrip:
class TestCacheFileLocation:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cache_lives_under_hermes_home_cache_dir_with_0600(
self, monkeypatch, tmp_path
):
diff --git a/tests/tools/test_modal_sandbox_fixes.py b/tests/tools/test_modal_sandbox_fixes.py
index c419f2d1b8d..c0148923f5d 100644
--- a/tests/tools/test_modal_sandbox_fixes.py
+++ b/tests/tools/test_modal_sandbox_fixes.py
@@ -85,7 +85,7 @@ class TestCwdHandling:
assert config["host_cwd"] is None
assert config["docker_mount_cwd_to_workspace"] is False
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_users_path_maps_to_workspace_for_docker_when_enabled(self, monkeypatch):
"""Docker should map the host cwd into /workspace only when explicitly enabled."""
monkeypatch.setenv("TERMINAL_ENV", "docker")
@@ -134,7 +134,7 @@ class TestCwdHandling:
f"Backend {backend}: expected /root default, got {config['cwd']}"
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_docker_default_cwd_maps_current_directory_when_enabled(self, monkeypatch):
"""Docker should use /workspace when cwd mounting is explicitly enabled."""
monkeypatch.setattr("tools.terminal_tool.os.getcwd", lambda: "/home/user/project")
diff --git a/tests/tools/test_process_registry.py b/tests/tools/test_process_registry.py
index c0292f5482e..32e943d15cc 100644
--- a/tests/tools/test_process_registry.py
+++ b/tests/tools/test_process_registry.py
@@ -144,7 +144,7 @@ def _wait_until(predicate, timeout: float = 5.0, interval: float = 0.05) -> bool
return False
def test_write_stdin_uses_str_for_windows_pty(registry):
"""pywinpty expects str input; bytes raises a PyString conversion error.
@@ -168,7 +168,7 @@ def test_write_stdin_uses_str_for_windows_pty(registry):
assert isinstance(written[0], str)
def test_write_stdin_uses_bytes_for_posix_pty(registry):
"""The POSIX counterpart: ptyprocess expects bytes, not str."""
written = []
@@ -187,7 +187,7 @@ def test_write_stdin_uses_bytes_for_posix_pty(registry):
assert written == [b"hello\n"]
def test_submit_stdin_uses_crlf_for_windows_pty(registry):
"""Enter on a Windows PTY is a carriage return, not a bare LF.
@@ -213,7 +213,7 @@ def test_submit_stdin_uses_crlf_for_windows_pty(registry):
assert written == ["Y\r\n"]
def test_submit_stdin_keeps_lf_for_windows_pipe(registry):
"""Non-PTY (Popen pipe) sessions keep the plain LF on Windows."""
session = _make_session(sid="pipe-win-submit")
@@ -570,7 +570,7 @@ class TestStdinHelpers:
proc.stdin.close.assert_called_once()
assert result["status"] == "ok"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_close_stdin_allows_eof_driven_process_to_finish(self, registry, tmp_path):
"""PTY mode: writing data + sending EOF lets an EOF-driven child finish.
@@ -708,7 +708,7 @@ class TestPruning:
# =========================================================================
class TestSpawnEnvSanitization:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_spawn_local_strips_blocked_vars_from_background_env(self, registry):
captured = {}
@@ -816,7 +816,7 @@ class TestSpawnEnvSanitization:
class TestPopenLeakOnSetupFailure:
"""Regression for issue #2749: subprocess orphaned when post-Popen setup raises."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_popen_killed_when_thread_creation_fails(self, registry):
"""If Thread() raises after Popen, proc must be killed — not orphaned."""
killed = []
@@ -918,7 +918,7 @@ class TestSpawnRewriteCompoundBackground:
# Simple background must remain as-is
assert "sleep 5 &" in shell_cmd
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_pty_path_uses_rewritten_command(self, registry):
"""PTY spawn path must also use the rewritten command (issue #68915)."""
mock_pty_proc = MagicMock()
@@ -1065,7 +1065,7 @@ class TestKillProcess:
assert result["status"] == "already_exited"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_kill_detached_session_uses_host_pid(self, registry):
s = _make_session(sid="proc_detached", command="sleep 999")
s.pid = 424242
@@ -1261,7 +1261,7 @@ class TestTerminateHostPidWindows:
target handle only, not the tree.
"""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_invokes_taskkill_with_tree_and_force_flags(self, monkeypatch):
"""The Windows branch must shell out to ``taskkill /PID N /T /F``.
@@ -1291,7 +1291,7 @@ class TestTerminateHostPidWindows:
class TestTerminateHostPidPosix:
"""POSIX branch walks the tree via psutil and SIGTERMs children first."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_walks_tree_and_terminates_children_then_parent(self, monkeypatch):
from tools import process_registry as pr
import psutil
@@ -1329,7 +1329,7 @@ class TestTerminateHostPidPosix:
"Children must be terminated before the parent"
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_oserror_falls_back_to_os_kill(self, monkeypatch):
from tools import process_registry as pr
import psutil
diff --git a/tests/tools/test_process_registry_write_stdin_surrogates.py b/tests/tools/test_process_registry_write_stdin_surrogates.py
index b8f0ddfd53c..1fbb547ead9 100644
--- a/tests/tools/test_process_registry_write_stdin_surrogates.py
+++ b/tests/tools/test_process_registry_write_stdin_surrogates.py
@@ -8,7 +8,7 @@ import pytest
from tools.process_registry import ProcessRegistry
def test_write_stdin_pty_surrogateescape_roundtrip(tmp_path):
registry = ProcessRegistry()
out = tmp_path / "out.bin"
diff --git a/tests/tools/test_read_special_file_guard.py b/tests/tools/test_read_special_file_guard.py
index 80ad78407bb..9550a8f0d24 100644
--- a/tests/tools/test_read_special_file_guard.py
+++ b/tests/tools/test_read_special_file_guard.py
@@ -26,13 +26,13 @@ class TestSpecialFileKind:
def test_missing_path(self, tmp_path):
assert _special_file_kind(tmp_path / "nope") is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_fifo(self, tmp_path):
fifo = tmp_path / "p.pipe"
os.mkfifo(fifo)
assert "FIFO" in (_special_file_kind(fifo) or "")
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_socket(self, tmp_path):
sock_path = tmp_path / "s.sock"
s = socket.socket(socket.AF_UNIX)
@@ -42,7 +42,7 @@ class TestSpecialFileKind:
finally:
s.close()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_symlink_to_fifo_followed(self, tmp_path):
fifo = tmp_path / "p.pipe"
os.mkfifo(fifo)
@@ -57,7 +57,7 @@ class TestSpecialFileKind:
class TestReadFileToolFifoGuard:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_fifo_read_returns_note_instantly(self, tmp_path, monkeypatch):
import time
diff --git a/tests/tools/test_skill_view_path_check.py b/tests/tools/test_skill_view_path_check.py
index c72504ca547..376ee9d90d1 100644
--- a/tests/tools/test_skill_view_path_check.py
+++ b/tests/tools/test_skill_view_path_check.py
@@ -85,10 +85,10 @@ class TestOldCheckWouldFail:
and resolved != skill_dir_resolved
)
- # ``windows_only`` rather than ``skipif(os.sep == "/")``: the Windows CI
+ # ``platforms("windows")`` rather than ``skipif(os.sep == "/")``: the Windows CI
# job greps for the marker to decide which files to import, so a bare
# skipif leaves this running on no host at all.
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_old_check_false_positive_on_windows(self, tmp_path):
"""On Windows, the old check incorrectly blocks valid subpaths."""
skill_dir = tmp_path / "skills" / "axolotl"
diff --git a/tests/tools/test_skills_sync_client.py b/tests/tools/test_skills_sync_client.py
index 1b0245d38ef..84855456ecc 100644
--- a/tests/tools/test_skills_sync_client.py
+++ b/tests/tools/test_skills_sync_client.py
@@ -353,7 +353,7 @@ class TestDevGate:
# ---------------------------------------------------------------------------
class TestObjectBuilding:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_build_tree_blob_and_exec(self, tmp_path):
d = tmp_path / "skill"
d.mkdir()
diff --git a/tests/tools/test_stage2_hook_api_server_keygen.py b/tests/tools/test_stage2_hook_api_server_keygen.py
index c4e9de764ad..34e53f49758 100644
--- a/tests/tools/test_stage2_hook_api_server_keygen.py
+++ b/tests/tools/test_stage2_hook_api_server_keygen.py
@@ -74,7 +74,7 @@ def _run_keygen(
)
def test_keygen_creates_env_when_missing(stage2_text: str, tmp_path: Path) -> None:
"""No .env at all (failed/absent first-boot seed) must still yield a key."""
home = tmp_path / "home"
@@ -200,7 +200,7 @@ def _sed_is_gnu() -> bool:
return probe.returncode == 0 and "GNU sed" in probe.stdout
def test_keygen_readonly_env_degrades_to_warning_not_boot_abort(
stage2_text: str, tmp_path: Path
) -> None:
diff --git a/tests/tools/test_terminal_cwd_echo.py b/tests/tools/test_terminal_cwd_echo.py
index 28120c0e8a1..1f9e145c16d 100644
--- a/tests/tools/test_terminal_cwd_echo.py
+++ b/tests/tools/test_terminal_cwd_echo.py
@@ -28,7 +28,7 @@ class TestCwdEcho:
# ``cd`` no-ops and the cwd never changes. Native-path handling in the
# terminal is a separate Windows workstream; the echo feature itself is
# covered by the Linux lane here.
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cd_reports_new_cwd(self, isolated_home, tmp_path):
target = tmp_path / "projdir"
target.mkdir()
@@ -42,7 +42,7 @@ class TestCwdEcho:
assert r["exit_code"] == 0
assert "cwd" not in r
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cwd_persists_and_stops_reporting_when_stable(self, isolated_home, tmp_path):
target = tmp_path / "stable"
target.mkdir()
@@ -53,7 +53,7 @@ class TestCwdEcho:
assert "cwd" not in r2
assert os.path.realpath(r2["output"].strip()) == os.path.realpath(str(target))
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_cd_within_chain_reports_final_dir(self, isolated_home, tmp_path):
a = tmp_path / "a"
b = tmp_path / "b"
diff --git a/tests/tools/test_terminal_output_transform_hook.py b/tests/tools/test_terminal_output_transform_hook.py
index 9381247d751..7c49a1a1147 100644
--- a/tests/tools/test_terminal_output_transform_hook.py
+++ b/tests/tools/test_terminal_output_transform_hook.py
@@ -93,7 +93,7 @@ def test_terminal_output_transform_still_runs_strip_and_redact(monkeypatch, tmp_
assert "abc123def456" not in result["output"] # secret body is gone
def test_large_process_output_is_bounded_before_sudo_and_plugin_hooks(
monkeypatch, tmp_path
):
diff --git a/tests/tools/test_terminal_truncation_spill.py b/tests/tools/test_terminal_truncation_spill.py
index cf27103b66d..8f7adbbd152 100644
--- a/tests/tools/test_terminal_truncation_spill.py
+++ b/tests/tools/test_terminal_truncation_spill.py
@@ -20,7 +20,7 @@ def small_cap(tmp_path, monkeypatch):
class TestTruncationSpill:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_truncated_output_has_metadata_and_spill(self, small_cap):
r = json.loads(terminal_tool(
"python3 -c \"print('marker_head'); [print(f'row_{i}', 'x'*80) for i in range(200)]; print('marker_tail')\"",
@@ -42,7 +42,7 @@ class TestTruncationSpill:
assert "full_output_path" not in r
assert "output_total_chars" not in r
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_spill_is_redacted(self, small_cap):
r = json.loads(terminal_tool(
"python3 -c \"print('sk-proj-' + 'a1B2c3D4e5F6g7H8i9J0' * 3); [print('pad', 'y'*90) for i in range(200)]\"",
@@ -61,7 +61,7 @@ class TestTruncationSpill:
"python3 -c \"[print('z'*90) for i in range(200)]\"", task_id="t-spill-4"))
assert not stale.exists()
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_failed_command_still_gets_spill(self, small_cap):
r = json.loads(terminal_tool(
"python3 -c \"[print('e'*90) for i in range(200)]; import sys; sys.exit(3)\"",
diff --git a/tests/tools/test_tirith_security.py b/tests/tools/test_tirith_security.py
index 3ed3365ee87..2eb3c8fffe0 100644
--- a/tests/tools/test_tirith_security.py
+++ b/tests/tools/test_tirith_security.py
@@ -54,7 +54,7 @@ def _json_stdout(findings=None, summary=""):
# Exit code → action mapping
# ---------------------------------------------------------------------------
class TestExitCodeMapping:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -95,7 +95,7 @@ class TestExitCodeMapping:
# JSON parse failure (exit code still wins)
# ---------------------------------------------------------------------------
class TestJsonParseFailure:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -121,7 +121,7 @@ class TestJsonParseFailure:
# Operational failures + fail_open
# ---------------------------------------------------------------------------
class TestOSErrorFailOpen:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -144,7 +144,7 @@ class TestOSErrorFailOpen:
assert "fail-closed" in result["summary"]
class TestTimeoutFailOpen:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -157,7 +157,7 @@ class TestTimeoutFailOpen:
assert "fail-closed" in result["summary"]
class TestUnknownExitCode:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -187,7 +187,7 @@ class TestDisabled:
# Findings cap + summary cap
# ---------------------------------------------------------------------------
class TestCaps:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -205,7 +205,7 @@ class TestCaps:
# Programming errors propagate
# ---------------------------------------------------------------------------
class TestProgrammingErrors:
@patch("tools.tirith_security.subprocess.run")
@patch("tools.tirith_security._load_security_config")
@@ -229,7 +229,7 @@ class TestEnsureInstalled:
_tirith_mod._resolved_path = None
assert ensure_installed() is None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
@patch("tools.tirith_security.shutil.which", return_value="/usr/local/bin/tirith")
@patch("tools.tirith_security._load_security_config")
def test_found_on_path_returns_immediately(self, mock_cfg, mock_which):
@@ -307,7 +307,7 @@ class TestUnsupportedPlatform:
# ---------------------------------------------------------------------------
class TestFailedDownloadCaching:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
@patch("tools.tirith_security._mark_install_failed")
@patch("tools.tirith_security._is_install_failed_on_disk", return_value=False)
@patch("tools.tirith_security._install_tirith", return_value=(None, "download_failed"))
@@ -350,7 +350,7 @@ class TestExplicitPathNoAutoDownload:
_tirith_mod._resolved_path = None
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
@patch("tools.tirith_security._mark_install_failed")
@patch("tools.tirith_security._is_install_failed_on_disk", return_value=False)
@patch("tools.tirith_security._install_tirith", return_value=("/auto/tirith", ""))
@@ -500,7 +500,7 @@ class TestInstallArchiveMemberValidation:
# ---------------------------------------------------------------------------
class TestBackgroundInstall:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_ensure_installed_non_blocking(self):
"""ensure_installed must return immediately when download needed."""
_tirith_mod._resolved_path = None
@@ -597,7 +597,7 @@ class TestHermesHomeIsolation:
# Warn-once dedupe (issue: tirith spawn failed spamming on Windows)
# ---------------------------------------------------------------------------
class TestSpawnWarningDedup:
"""When tirith isn't installed yet (background install in flight, or
install marked failed), every terminal command spammed an identical
@@ -648,7 +648,7 @@ _CFG = {"tirith_enabled": True, "tirith_path": "tirith",
"tirith_timeout": 5, "tirith_fail_open": True}
class TestAppTldSuppression:
"""warn verdicts whose only finding is lookalike_tld/.app are downgraded to allow."""
@@ -707,7 +707,7 @@ class TestIsAppTldFinding:
# mkdtemp OSError → no_space (disk-full leak prevention)
# ---------------------------------------------------------------------------
class TestMkdtempOSErrorNoSpace:
"""When tempfile.mkdtemp raises OSError (e.g. disk full), _install_tirith
must return (None, "no_space") instead of propagating the exception.
diff --git a/tests/tools/test_tts_macos_output.py b/tests/tools/test_tts_macos_output.py
index e890d7ad954..83c0442c878 100644
--- a/tests/tools/test_tts_macos_output.py
+++ b/tests/tools/test_tts_macos_output.py
@@ -74,12 +74,12 @@ def _run_stream(monkeypatch):
return sd_called["hit"]
def test_streaming_tts_skips_sounddevice_on_macos(monkeypatch):
assert _run_stream(monkeypatch) is False
def test_streaming_tts_uses_sounddevice_off_macos(monkeypatch):
# Off macOS the OutputStream setup runs; _import_sounddevice raising here
# is caught by the function's own guard, so the call itself is what we assert.
diff --git a/tests/tools/test_voice_mode.py b/tests/tools/test_voice_mode.py
index e129a669f22..b2ccac53797 100644
--- a/tests/tools/test_voice_mode.py
+++ b/tests/tools/test_voice_mode.py
@@ -120,7 +120,7 @@ def fake_clock(monkeypatch):
# detect_audio_environment — WSL / SSH / Docker detection
# ============================================================================
class TestPulseSocketReachable:
def test_stale_socket_file_not_reachable(self, monkeypatch, tmp_path):
"""A socket file with no listener should not count as reachable."""
@@ -564,7 +564,7 @@ class TestWhisperHallucinationFilter:
# ============================================================================
class TestPlayAudioFile:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_play_wav_via_sounddevice(self, monkeypatch, sample_wav):
np = pytest.importorskip("numpy")
# Linux-gated rather than faking a non-macOS platform: on macOS WAV
@@ -600,7 +600,7 @@ class TestMacOSAudioOutputPolicy:
a TCC media-library prompt, which no faked platform on Linux reproduces —
and `afplay` only resolves on a real macOS host."""
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_play_audio_file_skips_sounddevice_on_macos(self, monkeypatch, sample_wav):
"""On macOS, WAV playback must not import sounddevice; it routes to afplay."""
@@ -636,7 +636,7 @@ class TestMacOSAudioOutputPolicy:
assert popen_cmds, "expected a system player to be invoked"
assert popen_cmds[0][0] == "afplay"
- @pytest.mark.macos_only
+ @pytest.mark.platforms("macos")
def test_play_beep_routes_through_afplay_on_macos(self, monkeypatch):
"""On macOS, beeps synthesize with numpy but play via the tempfile/afplay path."""
pytest.importorskip("numpy")
@@ -1392,7 +1392,7 @@ class TestWSL2PowerShellFallback:
return next(it)
return _side_effect
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_powershell_pipeline_preserves_real_exit_status(self, sample_wav):
"""Regression (review of #63768): the shell pipeline must preserve
the (ffmpeg && powershell) exit status past the unconditional
@@ -1442,7 +1442,7 @@ class TestWSL2PowerShellFallback:
"Shell pipeline must preserve the real exit status past cleanup: " + sh_script
)
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_wsl2_unique_temp_filename(self, monkeypatch, tmp_path, sample_wav):
"""Two concurrent calls must use different temp WAV filenames."""
from unittest.mock import patch, MagicMock
diff --git a/tests/tools/test_wake_word.py b/tests/tools/test_wake_word.py
index fc05fa11de4..a0aa7b31522 100644
--- a/tests/tools/test_wake_word.py
+++ b/tests/tools/test_wake_word.py
@@ -251,7 +251,7 @@ def test_default_framework_tracks_the_macos_arm64_probe():
assert ww.default_inference_framework() == expected
def test_macos_arm64_prefers_tflite_on_this_host():
"""On a real ARM64 Mac the default must be tflite (upstream #336).
@@ -523,7 +523,7 @@ def test_detector_opens_configured_input_device_and_reports_backend(monkeypatch)
det.stop()
def test_windows_silent_hint_names_selected_device():
hint = ww.silent_audio_hint(
{
@@ -537,7 +537,7 @@ def test_windows_silent_hint_names_selected_device():
assert "macOS" not in hint
def test_macos_silent_hint_points_at_privacy_settings():
"""On macOS a silent stream is almost always the TCC mic permission, so the
hint names System Settings rather than the device."""
@@ -548,7 +548,7 @@ def test_macos_silent_hint_points_at_privacy_settings():
assert "Microphone" in hint
def test_linux_silent_hint_names_selected_device():
hint = ww.silent_audio_hint(
{"selector": 2, "name": "HD Audio Capture", "hostapi": "ALSA"}
diff --git a/tests/tools/test_windows_agent_loop_papercuts.py b/tests/tools/test_windows_agent_loop_papercuts.py
index 0b2c04c5904..ada9c7801c0 100644
--- a/tests/tools/test_windows_agent_loop_papercuts.py
+++ b/tests/tools/test_windows_agent_loop_papercuts.py
@@ -18,22 +18,22 @@ from hermes_cli._subprocess_compat import split_command_line
class TestSplitCommandLine:
"""#83934 / #78293 — backslashes in Windows paths must survive splitting."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_path_backslashes_preserved(self):
argv = split_command_line(r"sessions export C:\Users\me\Desktop\out.jsonl")
assert argv == ["sessions", "export", r"C:\Users\me\Desktop\out.jsonl"]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_quoted_path_with_spaces(self):
argv = split_command_line(r'run "C:\Program Files\App\tool.exe" --flag')
assert argv == ["run", r"C:\Program Files\App\tool.exe", "--flag"]
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_bare_hook_command_path(self):
argv = split_command_line(r"C:\Users\u\.local\bin\dcg.exe --hook pre")
assert argv[0] == r"C:\Users\u\.local\bin\dcg.exe"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_posix_behavior_unchanged(self):
assert split_command_line("echo 'a b' c") == ["echo", "a b", "c"]
@@ -45,14 +45,14 @@ class TestSplitCommandLine:
class TestShellHooksWindowsPaths:
"""#78293 — hook script paths with backslashes resolve correctly."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_command_script_path_keeps_backslashes(self):
from agent.shell_hooks import _command_script_path
path = _command_script_path(r"C:\hooks\guard.py --strict")
assert path == r"C:\hooks\guard.py"
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_script_is_executable_finds_real_file(self, tmp_path):
from agent.shell_hooks import script_is_executable
@@ -68,7 +68,7 @@ class TestShellHooksWindowsPaths:
class TestWindowsMarketingVersion:
"""#51755 — Windows 11 must not be reported as Windows 10."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_matches_build_number(self):
from agent.prompt_builder import _windows_marketing_version
diff --git a/tests/tools/test_windows_native_support.py b/tests/tools/test_windows_native_support.py
index bed8f6718fb..edd179eb0b3 100644
--- a/tests/tools/test_windows_native_support.py
+++ b/tests/tools/test_windows_native_support.py
@@ -82,11 +82,11 @@ class TestConfigureWindowsStdio:
# ---------------------------------------------------------------------------
class TestTerminatePidRoutingOnWindows:
"""``gateway.status.terminate_pid`` must use taskkill /T /F on Windows.
- ``windows_only``: this used to patch the module-level ``_IS_WINDOWS``
+ ``platforms("windows")``: this used to patch the module-level ``_IS_WINDOWS``
flag on Linux, which selected the taskkill branch on a host where
``taskkill`` does not exist and ``gateway/status`` cannot even import its
``msvcrt`` branch. On the Windows runner the flag is genuinely True, so
@@ -255,7 +255,7 @@ class TestProcessRegistryOSErrorWidening:
assert ProcessRegistry._is_host_pid_alive(os.getpid()) is True
class TestPidExistsOSErrorWidening:
"""gateway.status._pid_exists itself must widen Windows errors correctly.
@@ -264,7 +264,7 @@ class TestPidExistsOSErrorWidening:
gone PID instead of ``ProcessLookupError``. The function must catch the
wider ``OSError`` to match POSIX semantics.
- ``linux_only``: the subject is the POSIX fallback branch and its
+ ``platforms("linux")``: the subject is the POSIX fallback branch and its
``os.kill`` error handling, exercised with the errno values Windows
produces. Gating to Linux is what makes ``_IS_WINDOWS`` genuinely False
here instead of forced false by a patch.
@@ -426,11 +426,11 @@ class TestSubprocessCompatHelpers:
# name (fallback) — both are acceptable behaviours.
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_detach_flags_exclude_detached_process(self):
"""DETACHED_PROCESS must stay OUT of every detach bundle.
- ``windows_only`` (with ``IS_WINDOWS`` no longer patched): the helpers
+ ``platforms("windows")`` (with ``IS_WINDOWS`` no longer patched): the helpers
return 0 off Windows, so on Linux the old flag patch was the only
thing making the bit assertions reachable at all.
@@ -454,7 +454,7 @@ class TestSubprocessCompatHelpers:
"DETACHED_PROCESS must not be in the no-breakaway fallback either."
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_detach_flags_includes_breakaway_from_job(self):
"""CREATE_BREAKAWAY_FROM_JOB is load-bearing for the GUI-driven update path.
@@ -476,7 +476,7 @@ class TestSubprocessCompatHelpers:
"can respawn the gateway after Electron exits."
)
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_detach_flags_without_breakaway_drops_only_that_bit(self):
"""Fallback retry payload for restrictive job objects.
@@ -724,9 +724,9 @@ class TestLocalEnvironmentWindowsTempDir:
class TestLocalEnvironmentPathInjectionGated:
"""Sane PATH completion must stay POSIX-only."""
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_path_is_left_unchanged(self):
- """``windows_only``: the assertion is that a real Windows ``PATH``
+ """``platforms("windows")``: the assertion is that a real Windows ``PATH``
(``;``-separated, drive-lettered) comes back untouched. On Linux the
old ``_IS_WINDOWS`` patch made the function return early without ever
meeting a genuine Windows PATH."""
@@ -755,11 +755,11 @@ class TestGitBashPathNormalization:
assert _normalize_git_bash_path(None) is None
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_translation(self):
"""On native Windows, /c/Users/... becomes C:\\Users\\...
- ``windows_only``: the function's whole job is producing native
+ ``platforms("windows")``: the function's whole job is producing native
Windows paths, which is only meaningful where ``os.sep`` is ``\\``.
"""
import cli as cli_mod
@@ -931,7 +931,7 @@ class TestWindowlessGatewayRestartSpec:
hidden-console respawn spec (normalized interpreter + stable cwd + env
overlay)."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_noop_on_non_windows(self):
import hermes_cli.gateway_windows as gw
@@ -949,13 +949,13 @@ class TestWindowlessGatewayRestartSpec:
assert cwd == ""
assert env == {}
- @pytest.mark.windows_only
+ @pytest.mark.platforms("windows")
def test_windows_keeps_console_python_and_preserves_tail(self):
"""On Windows the console interpreter is kept (hidden-console launch,
NOT a pythonw swap — #54220/#56747) while every subsequent argument
is preserved verbatim.
- ``windows_only``: faking this on Linux needed two more fakes to hold
+ ``platforms("windows")``: faking this on Linux needed two more fakes to hold
it up — a pre-import so the lazy ``hermes_cli.gateway`` import didn't
re-run ``gateway/status``'s ``import msvcrt`` branch, and a mock of
``get_hermes_home`` because the real one's ``Path.resolve()`` consults
@@ -1001,7 +1001,7 @@ class TestWindowlessGatewayRestartSpec:
# ---------------------------------------------------------------------------
class TestGatewayRunRestartWatcherOuterPopenFallback:
"""The Windows ``/restart`` watcher in ``gateway.run`` spawns an outer
detached ``python -c <watcher>`` process with
@@ -1015,7 +1015,7 @@ class TestGatewayRunRestartWatcherOuterPopenFallback:
Behavioral: drives the real coroutine with a mocked ``subprocess.Popen``
rather than asserting on source text.
- ``windows_only``: this used to run on Linux behind a ``sys.platform``
+ ``platforms("windows")``: this used to run on Linux behind a ``sys.platform``
patch, and the breakaway-bit assertions had to be skipped there anyway
(``_subprocess_compat`` caches ``IS_WINDOWS`` at import, so the flags
were all 0) — i.e. the most important assertions in the class never
diff --git a/tests/tools/test_zombie_process_cleanup.py b/tests/tools/test_zombie_process_cleanup.py
index 929b4145030..87ed972671f 100644
--- a/tests/tools/test_zombie_process_cleanup.py
+++ b/tests/tools/test_zombie_process_cleanup.py
@@ -34,7 +34,7 @@ def _pid_alive(pid: int) -> bool:
class TestZombieReproduction:
"""Demonstrate that subprocesses survive when cleanup is not called."""
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_orphaned_processes_survive_without_cleanup(self):
"""REPRODUCTION: processes spawned directly survive if no one kills
them — this models the gap that causes zombie accumulation when
diff --git a/tests/tui_gateway/test_bot_relay_methods.py b/tests/tui_gateway/test_bot_relay_methods.py
index 274e627954f..ceca8466372 100644
--- a/tests/tui_gateway/test_bot_relay_methods.py
+++ b/tests/tui_gateway/test_bot_relay_methods.py
@@ -116,7 +116,7 @@ def test_reply_roundtrip_and_id_validation(home):
assert "error" in err
def test_deliver_write_failure_still_removes_tempfile(home, monkeypatch, tmp_path):
"""A failed payload write must not leak the relay DM tempfile."""
import glob
diff --git a/tests/tui_gateway/test_compute_host.py b/tests/tui_gateway/test_compute_host.py
index cc76f87698c..6b2249af6c8 100644
--- a/tests/tui_gateway/test_compute_host.py
+++ b/tests/tui_gateway/test_compute_host.py
@@ -30,7 +30,7 @@ def _read_json_line(out: queue.Queue[dict], timeout: float = 2.0) -> dict:
raise AssertionError("timed out waiting for compute host JSON") from exc
def test_compute_host_line_json_seed_turn_interrupt():
repo = Path(__file__).resolve().parents[2]
env = dict(os.environ)
diff --git a/tests/tui_gateway/test_entry_import_off_main_thread.py b/tests/tui_gateway/test_entry_import_off_main_thread.py
index 233d7e896d9..136b7c3deb1 100644
--- a/tests/tui_gateway/test_entry_import_off_main_thread.py
+++ b/tests/tui_gateway/test_entry_import_off_main_thread.py
@@ -67,7 +67,7 @@ def _spawn_worker_import_entry():
return proc.returncode, proc.stdout, proc.stderr
def test_entry_imports_cleanly_from_worker_thread():
"""First import of tui_gateway.entry from a worker thread must succeed."""
rc, out, err = _spawn_worker_import_entry()
diff --git a/tests/verify/test_environment_and_runner.py b/tests/verify/test_environment_and_runner.py
index 852f015e78d..e8d486aa2b4 100644
--- a/tests/verify/test_environment_and_runner.py
+++ b/tests/verify/test_environment_and_runner.py
@@ -130,7 +130,7 @@ def _free_port() -> int:
class TestReadiness:
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_readiness_against_live_server(self, tmp_path):
port = _free_port()
recipe = Recipe(