"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
Merge PR #2077: allow POSIX heredocs with isolated platform tests
Haozhe Wu3e3082fb3a4d
diff --cc agent/tests/test_bash_tool.pyindex c1c7623ce,5273e1e10..fe306901a--- a/agent/tests/test_bash_tool.py+++ b/agent/tests/test_bash_tool.py@@@ -2,6 -2,6 +2,8 @@@from __future__ import annotations++from tests.module_os_helpers import patch_module_os++import jsonimport subprocessfrom unittest.mock import MagicMock@@@ -131,7 -131,8 +133,8 @@@ def test_timeout_kills_process_tree(monassert len(kills) == 1- def test_heredoc_unsupported(monkeypatch: pytest.MonkeyPatch) -> None:+ def test_heredoc_unsupported_on_windows(monkeypatch: pytest.MonkeyPatch) -> None:- monkeypatch.setattr(bash_tool.os, "name", "nt")++ patch_module_os(monkeypatch, bash_tool, name="nt")popen = MagicMock(side_effect=AssertionError("heredoc reached subprocess"))monkeypatch.setattr(bash_tool.subprocess, "Popen", popen)@@@ -140,3 -141,16 +143,16 @@@assert result["status"] == "error"assert result["error_code"] == "heredoc_unsupported"popen.assert_not_called()+++ def test_heredoc_allowed_on_posix(monkeypatch: pytest.MonkeyPatch) -> None:+ """POSIX shells support heredocs natively; the command must reach the+ real shell instead of being rejected with a Windows-only error.+ """- monkeypatch.setattr(bash_tool.os, "name", "posix")++ patch_module_os(monkeypatch, bash_tool, name="posix")+ fake = _FakePopen()+ _install_fake_popen(monkeypatch, fake)++ result = json.loads(BashTool().execute(command="cat <<EOF\nhello\nEOF"))++ assert result["status"] == "ok"