diff --git a/tests/test_project_status_tool.py b/tests/test_project_status_tool.py index 0c7401a..1a7cb8d 100644 --- a/tests/test_project_status_tool.py +++ b/tests/test_project_status_tool.py @@ -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():