From 2cd11aa52a7479ce9f06ac99d36b51e952b2a94a Mon Sep 17 00:00:00 2001 From: OpenCode Date: Thu, 9 Jul 2026 10:25:58 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20recalibration=20gate=20e2e=20test=20?= =?UTF-8?q?=E2=80=94=20call=20script=20directly,=20not=20via=20make?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make exits with code 2 on any recipe failure regardless of the script's exit code, so asserting returncode==3 from make always failed. Call the Python module directly to get the true exit code from the gate script. --- tests/test_recalibration_gate_e2e.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_recalibration_gate_e2e.py b/tests/test_recalibration_gate_e2e.py index 12b80d8f..e43285df 100644 --- a/tests/test_recalibration_gate_e2e.py +++ b/tests/test_recalibration_gate_e2e.py @@ -13,15 +13,21 @@ def test_recalibration_gate_example_runs_and_fails_closed(): ) assert r.returncode == 0, f"make lab-result-intake-example failed: {r.stderr[:200]}" + repo = Path(__file__).parents[1] r = subprocess.run( - ["make", "recalibration-gate-example"], + [sys.executable, "-m", "openamp_foundry.cli", "recalibration-gate", + "--intake-report", "outputs/calibration_intake_example.json", + "--intake-report-date", "2026-07-04", + "--out-json", "outputs/recalibration_gate_example.json", + "--out-md", "outputs/recalibration_gate_example.md"], capture_output=True, text=True, - cwd=Path(__file__).parents[1], + cwd=repo, + env={**__import__("os").environ, "PYTHONPATH": "src"}, ) # Gate correctly fails-closed (exit 3) because cohort size 4 < minimum 5 assert r.returncode == 3, ( f"Expected exit 3 (fail-closed), got {r.returncode}. " - f"Gate should reject cohort < 5 candidates." + f"Gate should reject cohort < 5 candidates.\nstdout: {r.stdout[:300]}\nstderr: {r.stderr[:300]}" )