Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/stagehand/_custom/sea_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ def resolve_binary_path(
raise FileNotFoundError(
f"Stagehand SEA binary not found at {candidate}.\n"
f"For local development, download the binary using:\n"
f" uv run python scripts/download-binary.py\n"
f" uv run python scripts/download_binary.py\n"
f"Or set the STAGEHAND_SEA_BINARY environment variable to point to your binary.\n"
f"For production use, install a platform-specific wheel from PyPI.\n"
f"See: https://github.com/browserbase/stagehand-python#local-development"
f"See: https://github.com/browserbase/stagehand-python/blob/main/CONTRIBUTING.md"
)

_ensure_executable(candidate)
Expand Down
18 changes: 18 additions & 0 deletions tests/test_sea_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,21 @@ def _fake_http_get_json(_url: str) -> list[dict[str, str]]:
monkeypatch.setattr(download_binary, "_http_get_json", _fake_http_get_json)

assert download_binary.resolve_latest_server_tag() == "stagehand-server-v3/v3.19.1"


def test_missing_binary_error_uses_valid_download_instructions(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv("STAGEHAND_SEA_BINARY", raising=False)

def _missing_resource(_filename: str) -> None:
return None

monkeypatch.setattr(sea_binary, "_resource_binary_path", _missing_resource)
monkeypatch.setattr(sea_binary, "default_binary_filename", lambda: "missing-stagehand-binary")

with pytest.raises(FileNotFoundError) as exc_info:
sea_binary.resolve_binary_path()

message = str(exc_info.value)
assert "uv run python scripts/download_binary.py" in message
assert "scripts/download-binary.py" not in message
assert "blob/main/CONTRIBUTING.md" in message