From ff88a2c525abe71b859c10f9e9b344d90845570e Mon Sep 17 00:00:00 2001 From: Alpamys Date: Thu, 26 Mar 2026 12:46:29 +0500 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20CI=20failures=20on=20macOS=20?= =?UTF-8?q?=E2=80=94=20speculative=20decoding=20flag=20collision=20+=20mis?= =?UTF-8?q?sing=20fastapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename --spec-tokens to --num-speculative-tokens to avoid prefix collision with --speculative-decoding in Typer help rendering - Add pytest.skip for _create_app tests when fastapi is not installed --- soup_cli/commands/serve.py | 3 +-- tests/test_speculative_decoding.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/soup_cli/commands/serve.py b/soup_cli/commands/serve.py index a87d193..306ecab 100644 --- a/soup_cli/commands/serve.py +++ b/soup_cli/commands/serve.py @@ -69,12 +69,11 @@ def serve( speculative_model: Optional[str] = typer.Option( None, "--speculative-decoding", - "--spec-dec", help="Draft model for speculative decoding (smaller/faster model ID or path)", ), num_speculative_tokens: int = typer.Option( 5, - "--spec-tokens", + "--num-speculative-tokens", help="Number of tokens the draft model generates per step (speculative decoding)", ), ): diff --git a/tests/test_speculative_decoding.py b/tests/test_speculative_decoding.py index 161bbaa..e8d2986 100644 --- a/tests/test_speculative_decoding.py +++ b/tests/test_speculative_decoding.py @@ -23,7 +23,7 @@ class TestSpeculativeDecodingCLI: assert "--speculative-decoding" in result.output def test_serve_spec_tokens_flag_exists(self): - """The serve command should accept --spec-tokens flag.""" + """The serve command should accept --num-speculative-tokens flag.""" from typer.testing import CliRunner from soup_cli.cli import app @@ -31,7 +31,7 @@ class TestSpeculativeDecodingCLI: runner = CliRunner() result = runner.invoke(app, ["serve", "--help"]) assert result.exit_code == 0 - assert "--spec-tokens" in result.output + assert "--num-speculative-tokens" in result.output # ─── Draft Model Loading Tests ──────────────────────────────────────────── @@ -200,6 +200,11 @@ class TestCreateAppWithDraftModel: def test_create_app_accepts_draft_model(self): """_create_app should accept draft_model parameter.""" + try: + import fastapi # noqa: F401 + except ImportError: + pytest.skip("FastAPI not installed") + mock_model = MagicMock() mock_tokenizer = MagicMock() mock_draft = MagicMock() @@ -219,6 +224,11 @@ class TestCreateAppWithDraftModel: def test_create_app_without_draft_model(self): """_create_app should work without draft_model.""" + try: + import fastapi # noqa: F401 + except ImportError: + pytest.skip("FastAPI not installed") + mock_model = MagicMock() mock_tokenizer = MagicMock()