test(project-status): skip exec_real when gh CLI unavailable
All checks were successful
CI / bootstrap (push) Successful in 7s
CI / lint (push) Successful in 20s
CI / typecheck (push) Successful in 28s
CI / test (3.12) (push) Successful in 1m41s
CI / test (3.13) (push) Successful in 1m35s
CI / test (3.14) (push) Successful in 1m28s
CI / complexity (push) Successful in 29s

This commit is contained in:
opencode-agent 2026-08-06 14:45:18 +00:00
parent 9459e47567
commit 77143ac6da

View file

@ -30,6 +30,25 @@ from pathlib import Path
import pytest
def _gh_available() -> bool:
"""True if `gh auth status` succeeds (local dev machine, not CI runner)."""
try:
return (
subprocess.run(
["gh", "auth", "status"],
capture_output=True,
check=False,
).returncode
== 0
)
except FileNotFoundError:
return False
_GH_OK = _gh_available()
_SKIP_REASON = "gh CLI not authenticated — skip real project-status.py call"
REPO_ROOT = Path(__file__).resolve().parent.parent
LOADER = REPO_ROOT / "tests" / "_ts_loader.mjs"
TS_FILE = REPO_ROOT / ".opencode" / "tools" / "project-status.ts"
@ -150,6 +169,7 @@ def test_execute_uses_cwd_from_context():
)
@pytest.mark.skipif(not _GH_OK, reason=_SKIP_REASON)
def test_execute_real_project_status():
"""Integration: execute() returns the real project-status.py output (non-blocking)."""
if not (REPO_ROOT / ".opencode" / "scripts" / "project-status.py").exists():