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
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:
parent
9459e47567
commit
77143ac6da
1 changed files with 20 additions and 0 deletions
|
|
@ -30,6 +30,25 @@ from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
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
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||||
LOADER = REPO_ROOT / "tests" / "_ts_loader.mjs"
|
LOADER = REPO_ROOT / "tests" / "_ts_loader.mjs"
|
||||||
TS_FILE = REPO_ROOT / ".opencode" / "tools" / "project-status.ts"
|
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():
|
def test_execute_real_project_status():
|
||||||
"""Integration: execute() returns the real project-status.py output (non-blocking)."""
|
"""Integration: execute() returns the real project-status.py output (non-blocking)."""
|
||||||
if not (REPO_ROOT / ".opencode" / "scripts" / "project-status.py").exists():
|
if not (REPO_ROOT / ".opencode" / "scripts" / "project-status.py").exists():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue