From 899ad8edf771319c4abce1b7a2c32e322f551181 Mon Sep 17 00:00:00 2001 From: Alpamys Date: Mon, 20 Apr 2026 21:51:23 +0500 Subject: [PATCH] test(eval_gate): strip ANSI escapes in train --help CI assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `test_train_gate_flag_accepted` asserted `"--gate" in result.output`, but Typer/Click under CI emits ANSI color codes that split the flag name into non-contiguous chars: `\x1b[1;36m-\x1b[0m\x1b[1;36m-gate\x1b[0m`. The literal "--gate" substring is never present. All 9 OS × Python combos failed on the v0.26.0 Parts B-E push. Fix: strip ANSI via regex before checking. Also assert on "eval-gated" from the option description to double-check the flag is wired to its help text. CI-only / tests-only: no soup_cli/ changes, no version bump needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/test_eval_gate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_eval_gate.py b/tests/test_eval_gate.py index 23aa936..a16e45f 100644 --- a/tests/test_eval_gate.py +++ b/tests/test_eval_gate.py @@ -489,6 +489,12 @@ class TestEvalGateCLI: class TestTrainGateFlag: def test_train_gate_flag_accepted(self, tmp_path, monkeypatch): """The --gate flag must be visible in `soup train --help`.""" + import re + result = runner.invoke(app, ["train", "--help"]) assert result.exit_code == 0, (result.output, repr(result.exception)) - assert "--gate" in result.output + # Strip ANSI escape sequences — macOS CI runners emit color codes + # that split "--gate" into non-contiguous characters (see commit msg). + cleaned = re.sub(r"\x1b\[[0-9;]*m", "", result.output) + assert "--gate" in cleaned + assert "eval-gated" in cleaned