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 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 01:07:59 +03:00
committed by orchestrator-deployer
parent eadfd8419b
commit 9647fe1ffb

View File

@@ -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)