tests: make hardcoded /tmp assertions OS-neutral (#6864)

Root cause: _is_sensitive_path splits on os.sep, so POSIX literals missed
on Windows; /tmp is not a root on Windows (only $TMPDIR); inline-JSON test
compared against "/tmp/wf.txt" while Windows abspath is C:\tmp\wf.txt.
Change: native-separator helper, TMPDIR monkeypatch, abspath alternative.
Before: 9 failed; after: 0 failed (74 passed, 1 symlink skip).

Part of #4287

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Alexandre Teixeira <general@alexandreteixeira.dev>
This commit is contained in:
indieindie7
2026-11-01 01:33:28 +00:00
committed by GitHub
co-authored by Claude Fable 5.1 Alexandre Teixeira
parent 64b457dc0a
commit 6a43cf23ea
2 changed files with 20 additions and 12 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
import importlib
import json
import os
import sys
import types
from types import SimpleNamespace
@@ -1202,7 +1203,7 @@ async def test_write_file_inline_json_args(monkeypatch):
for b in blocks:
await _execute_without_run_context(execute_tool_block, b, owner="admin", workspace="/tmp")
assert captured.get("path") == "/tmp/wf.txt", (
assert captured.get("path") in ("/tmp/wf.txt", os.path.abspath("/tmp/wf.txt")), (
f"write_file did not decode inline JSON args; got path {captured.get('path')!r}"
)