test(eval_gate): strip ANSI escapes in train --help CI assertion

`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) <noreply@anthropic.com>
This commit is contained in:
Alpamys 2026-04-20 21:51:23 +05:00
parent ddab34115c
commit 899ad8edf7
1 changed files with 7 additions and 1 deletions

View File

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