From 9647fe1ffb80180b1939c03985bced27849c6ab3 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Wed, 10 Jun 2026 01:07:59 +0300 Subject: [PATCH] fix(coverage): use sys.executable for the pytest --cov subprocess (ORCH-027) measure_coverage hardcoded "python" for the coverage subprocess; the prod container and the CI runner expose "python3" (a bare "python" may be absent), and pytest-cov lives in exactly the running interpreter's environment. Use sys.executable so the measurement always runs under the same interpreter as the orchestrator. Refs: ORCH-027 Co-Authored-By: Claude Opus 4.8 --- src/coverage_gate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coverage_gate.py b/src/coverage_gate.py index d13c9f8..664fb68 100644 --- a/src/coverage_gate.py +++ b/src/coverage_gate.py @@ -53,6 +53,7 @@ import json import logging import os import subprocess +import sys from .config import settings from .git_worktree import ensure_worktree, get_worktree_path @@ -140,8 +141,11 @@ def measure_coverage(repo: str, branch: str) -> float | None: except OSError: pass + # Use the SAME interpreter that runs the orchestrator (sys.executable), not a + # bare "python" — the prod container / CI runner expose "python3", and the + # pytest-cov plugin lives in exactly this interpreter's environment. cmd = [ - "python", "-m", "pytest", "tests/", + sys.executable, "-m", "pytest", "tests/", "--cov=src", f"--cov-report=json:{cov_json}", "--cov-report=", # suppress the terminal cov report (json only)