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).
This commit is contained in:
Alpamys 2026-06-09 00:05:36 +05:00
parent 70fd5ee9f3
commit ae6a18e7d7
1 changed files with 9 additions and 3 deletions

View File

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