Skip to content

The agent that grows with you

test(browser): isolate chrome-fallback sandbox test from the shared tmpdir

Teknium4789fa10666d
diff --git a/tests/tools/test_browser_lightpanda.py b/tests/tools/test_browser_lightpanda.py
index 3ba7b5860fd..d27b6f95b60 100644
--- a/tests/tools/test_browser_lightpanda.py
+++ b/tests/tools/test_browser_lightpanda.py
@@ -217,7 +217,7 @@ class TestChromeFallback:
)
assert result == {"success": False, "error": "stop"}
- def test_chrome_fallback_injects_required_sandbox_args(self):
+ def test_chrome_fallback_injects_required_sandbox_args(self, tmp_path):
import tools.browser_tool as bt
captured_envs = []
@@ -229,9 +229,15 @@ class TestChromeFallback:
captured_envs.append(kwargs["env"])
return mock_proc
+ # Keep the fallback's socket dir under this test's private tmp_path.
+ # Using the real shared tmpdir raced concurrent orphan reapers from
+ # sibling pytest processes (atexit _emergency_cleanup_all_sessions),
+ # which rmtree'd the fresh pidless dir mid-command — the CI flake
+ # this test kept hitting before the reaper grace fix.
with patch("tools.browser_tool._run_browser_command", return_value={
"success": True, "data": {"url": "https://example.com/"}
}), \
+ patch("tools.browser_tool._socket_safe_tmpdir", return_value=str(tmp_path)), \
patch("tools.browser_tool._find_agent_browser", return_value="/usr/bin/agent-browser"), \
patch("tools.browser_tool._chromium_installed", return_value=True), \
patch("tools.browser_tool._needs_chromium_sandbox_bypass", return_value=True), \