From ae6a18e7d755ec3032e049a756b8537cec59719e Mon Sep 17 00:00:00 2001 From: Alpamys Date: Tue, 9 Jun 2026 00:05:36 +0500 Subject: [PATCH] test(v0.71.18): ANSI-strip the --minillm-on-policy --help assertion for CI FORCE_COLOR TestTrainCliMinillmOnPolicy::test_flag_in_help removed newlines + spaces but not ANSI codes, so under CI FORCE_COLOR the Rich-rendered long flag (ANSI codes between the dashes) failed the substring check. Strip ANSI + remove all whitespace before the check, matching the cloud/sandbox help tests + the v0.71.17 precedent. Verified under FORCE_COLOR=1 (114 passed). --- tests/test_v07118.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_v07118.py b/tests/test_v07118.py index b8d4457..6add0fa 100644 --- a/tests/test_v07118.py +++ b/tests/test_v07118.py @@ -371,14 +371,20 @@ class TestDistillOnPolicyWiring: class TestTrainCliMinillmOnPolicy: def test_flag_in_help(self): + import re + from typer.testing import CliRunner from soup_cli.cli import app result = CliRunner().invoke(app, ["train", "--help"]) - out = result.stdout.replace("\n", " ") - # ANSI/Rich may split on dashes — collapse whitespace and check tokens. - assert "minillm-on-policy" in out.replace(" ", "") + # Rich + FORCE_COLOR on CI inject ANSI codes between the flag's dashes + # and may wrap the long flag across lines — strip ANSI + remove ALL + # whitespace (incl. newlines) before the substring check. (v0.71.17 + # CI FORCE_COLOR precedent — `_strip_ansi` is defined later in the file.) + out = re.sub(r"\x1b\[[0-9;]*m", "", result.stdout) + out = re.sub(r"\s+", "", out) + assert "--minillm-on-policy" in out # ===========================================================================