From 47409df730136657330359fa0142b09171e43655 Mon Sep 17 00:00:00 2001 From: Alpamys Date: Tue, 19 May 2026 13:15:28 +0500 Subject: [PATCH] =?UTF-8?q?fix(tests):=20v0.60.0=20CI=20green=20=E2=80=94?= =?UTF-8?q?=20widen=20version=20floors=20+=20strip=20ANSI=20from=20merge?= =?UTF-8?q?=20help=20assert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three failures on CI run 26084542388 — all are version-pin / Rich-wrap artefacts, not real regressions in v0.60.0 functionality: - test_v0560 test_pyproject_version: regex-based >=0.56 floor check (was substring `version = "0.5`) - test_v0590 test_version_is_0_59 -> test_version_is_at_least_0_59: >=0.59 floor (matches v0.51/v0.54 floor-check idiom) - test_v0600_part_e merge_help_lists_license_flags: strip ANSI codes before substring check (Rich splits `--license` across `\x1b[1;36m` escapes in the wrapped Typer table) Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/test_v0560.py | 10 +++++++++- tests/test_v0590.py | 10 ++++++++-- tests/test_v0600_part_e.py | 17 +++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/test_v0560.py b/tests/test_v0560.py index d112bed..b65faae 100644 --- a/tests/test_v0560.py +++ b/tests/test_v0560.py @@ -781,8 +781,16 @@ class TestSourceWiring: assert __version__ >= "0.56.0" def test_pyproject_version(self) -> None: + import re + text = (_PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8") - assert 'version = "0.5' in text # floor check; current v0.5x.y + # Floor check — v0.56.0 was the first release that needed this guard. + # We accept any v0.. >= 0.56.0 so future releases (v0.6x, + # v0.7x, ...) don't have to edit this line. + m = re.search(r'^version = "(0\.\d+\.\d+)"', text, re.MULTILINE) + assert m, "pyproject.toml missing version line" + major, minor, _patch = m.group(1).split(".") + assert int(major) == 0 and int(minor) >= 56, m.group(1) # --- review-fix coverage -------------------------------------------------- diff --git a/tests/test_v0590.py b/tests/test_v0590.py index e6af989..ecf168c 100644 --- a/tests/test_v0590.py +++ b/tests/test_v0590.py @@ -964,8 +964,14 @@ class TestSourceWiring: assert "bom" in text.lower() assert "attest" in text.lower() - def test_version_is_0_59(self): - assert soup_cli.__version__ == "0.59.0" + def test_version_is_at_least_0_59(self): + """v0.59 floor — widens automatically as later releases bump version. + + Matches the v0.51.0 / v0.54.0 floor-check idiom so later releases + don't have to edit this assertion. + """ + major, minor, _patch = soup_cli.__version__.split(".") + assert int(major) == 0 and int(minor) >= 59, soup_cli.__version__ def test_no_top_level_heavy_imports(self): """v0.59 modules must not import torch/transformers at module top.""" diff --git a/tests/test_v0600_part_e.py b/tests/test_v0600_part_e.py index 5c84d09..523f9bb 100644 --- a/tests/test_v0600_part_e.py +++ b/tests/test_v0600_part_e.py @@ -229,14 +229,27 @@ class TestMergeIntegration: """Regression: license gate is wired into `soup adapters merge`.""" def test_merge_help_lists_license_flags(self): + """Both --license and --license-override must surface in the help text. + + Rich's table renderer can split option names across ANSI styling + escape sequences, so a naive ``"--license" in result.output`` may + miss the bare option. We strip ANSI codes first. + """ + import re + from typer.testing import CliRunner from soup_cli.cli import app runner = CliRunner() result = runner.invoke(app, ["adapters", "merge", "--help"]) assert result.exit_code == 0, (result.output, repr(result.exception)) - assert "--license" in result.output - assert "--license-override" in result.output + # Strip ANSI escape sequences; merge whitespace. + clean = re.sub(r"\x1b\[[0-9;]*[mGKHF]", "", result.output) + clean = re.sub(r"\s+", " ", clean) + assert "--license-override" in clean + # Bare --license option (Typer may render with TEXT type hint + # immediately after); accept either form. + assert "--license " in clean or "--license\n" in clean or "--license " in result.output def test_merge_refuses_license_conflict_without_override(self, tmp_path, monkeypatch): """Two adapters with incompatible licenses + no override → exit 3."""