项目文件夹

文件
Sarath Suresh c390388beb refactor: move to src layout, agent-workspace, and fix SKILL.md invocation format
- Move package to src/browser_harness/ and domain-skills/interaction-skills to agent-workspace/
- Fix all browser-harness <<'PY' heredoc examples in SKILL.md and run.py HELP string to use the correct -c '...' flag format (heredoc was never supported by the CLI)
- Update SKILL.md path references from domain-skills/ to agent-workspace/domain-skills/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 15:34:31 +05:30

30 行
972 B
Python

import sys
from io import StringIO
from unittest.mock import patch
from browser_harness import run
def test_c_flag_executes_code():
stdout = StringIO()
with patch.object(sys, "argv", ["browser-harness", "-c", "print('hello from -c')"]), \
patch("browser_harness.run.ensure_daemon"), \
patch("browser_harness.run.print_update_banner"), \
patch("sys.stdout", stdout):
run.main()
assert stdout.getvalue().strip() == "hello from -c"
def test_c_flag_does_not_read_stdin():
stdin_read = []
fake_stdin = StringIO("should not be read")
fake_stdin.read = lambda: stdin_read.append(True) or ""
with patch.object(sys, "argv", ["browser-harness", "-c", "x = 1"]), \
patch("browser_harness.run.ensure_daemon"), \
patch("browser_harness.run.print_update_banner"), \
patch("sys.stdin", fake_stdin):
run.main()
assert not stdin_read, "stdin should not be read when -c is passed"