state-hub/tests/test_codex_mcp_launcher.py
tegwick 5927591be8
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 1m0s
Prepare State Hub retirement baseline
2026-08-09 16:19:53 +02:00

40 lines
1.1 KiB
Python

import os
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
LAUNCHER = ROOT / "scripts" / "codex-state-hub-mcp.sh"
def test_codex_mcp_launcher_uses_configured_python(tmp_path: Path) -> None:
fake_python = tmp_path / "python"
fake_python.write_text(
"#!/usr/bin/env bash\n"
"printf 'python=%s\\nscript=%s\\ntransport=%s\\n' "
'"$0" "$1" "$MCP_TRANSPORT"\n'
)
fake_python.chmod(0o755)
env = os.environ.copy()
env["STATE_HUB_PYTHON"] = str(fake_python)
env["API_BASE"] = "http://127.0.0.1:8000"
result = subprocess.run(
[str(LAUNCHER)],
cwd=ROOT,
env=env,
text=True,
capture_output=True,
check=True,
timeout=5,
)
assert f"python={fake_python}" in result.stdout
assert "script=mcp_server/codex_server.py" in result.stdout
assert "transport=stdio" in result.stdout
def test_codex_mcp_launcher_has_no_uv_runtime_dependency() -> None:
launcher = LAUNCHER.read_text()
assert "uv run" not in launcher
assert ".venv/bin/python" in launcher