fix: use ANSI-safe assertions in eval human help test (macOS CI fix)

Rich markup wraps --model-a with ANSI codes on macOS, breaking the
substring check. Strip ANSI codes before asserting, matching the
existing pattern in test_speculative_decoding.py and test_deploy_ollama.py.
This commit is contained in:
Alpamys 2026-04-01 14:51:38 +05:00
parent c46265fd18
commit 45522ef4e7
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
"""Tests for the eval platform: custom eval, judge, human eval, leaderboard, compare."""
import json
import re
from unittest.mock import MagicMock, patch
import pytest
@ -54,6 +55,11 @@ from soup_cli.eval.leaderboard import (
runner = CliRunner()
def _strip_ansi(text: str) -> str:
"""Remove ANSI escape codes from Rich-formatted output."""
return re.sub(r'\x1b\[[0-9;]*m', '', text)
# ═══════════════════════════════════════════════════════════
# Custom Eval — Scoring Functions
# ═══════════════════════════════════════════════════════════
@ -1002,7 +1008,8 @@ class TestEvalCLI:
def test_eval_human_help(self):
result = runner.invoke(app, ["eval", "human", "--help"])
assert result.exit_code == 0
assert "model-a" in result.output.lower()
clean = _strip_ansi(result.output).lower()
assert "model-a" in clean
def test_eval_auto_help(self):
result = runner.invoke(app, ["eval", "auto", "--help"])