项目文件夹

文件
Sarath S Menon fb1a51dd9b refactor: move to src layout, agent-workspace, and fix SKILL.md invocation format (#229)
* refactor(tests): reorganize into tests/unit and tests/integration

Moves all root-level test_*.py files into a structured tests/ directory:
- tests/unit/ — admin, helpers (was test_screenshot), run
- tests/integration/ — js expression tests
- tests/conftest.py — shared fake_png pytest fixture, eliminating duplication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* 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>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 15:38:11 +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"