Gate the POSIX-only and symlink-only tests with the linux_only and require_symlinks markers. Fix the real cross-platform bugs: - file_operations: use the translate_path flag, send snippets as base64, and use sys.executable (the MS Store python3 stub and the list2cmdline backslash collapse both broke snippets) - approval: treat backslash as a Windows path separator, not an escape - registry, browser_registry, secret_sources, plugins: normalize scope-key case - checkpoint_manager, plugins_cmd: clear read-only bits before delete - deadline: make MAX_SAFE_TIMEOUT_S fit the Windows limit - image_routing, acp, cua_backend, daytona: fix Windows and POSIX paths - hermes_state: match backslash in the retag LIKE clause - kanban, disk-cleanup: match drive paths and split command arguments - scripts: emit host separators through as_posix 207 test files are gated or isolated.
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Oneshot stdout must survive lone UTF-16 surrogates in model text (#80366)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import textwrap
|
|
from pathlib import Path
|
|
|
|
|
|
def test_oneshot_replaces_lone_surrogate_and_exits_zero():
|
|
"""hermes -z must print U+FFFD and exit 0 when the model returns U+D800."""
|
|
program = textwrap.dedent(
|
|
"""
|
|
import hermes_cli.oneshot as oneshot
|
|
|
|
dirty = "answer \\ud800 here"
|
|
oneshot._run_agent = lambda *args, **kwargs: (
|
|
dirty,
|
|
{"final_response": dirty, "failed": False, "partial": False, "completed": True},
|
|
)
|
|
raise SystemExit(oneshot.run_oneshot("hello"))
|
|
"""
|
|
)
|
|
|
|
result = subprocess.run(
|
|
[sys.executable, "-c", program],
|
|
cwd=Path(__file__).resolve().parents[2],
|
|
capture_output=True,
|
|
timeout=30,
|
|
check=False,
|
|
)
|
|
|
|
assert result.returncode == 0, result.stderr.decode("utf-8", errors="replace")
|
|
# U+FFFD as UTF-8; no raw surrogate bytes
|
|
assert "\ufffd".encode("utf-8") in result.stdout
|
|
assert b"answer " in result.stdout
|
|
assert (" here" + os.linesep).encode("ascii") in result.stdout
|
|
assert b"Traceback" not in result.stderr
|