fix: resolve CI failures on macOS — speculative decoding flag collision + missing fastapi

- 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
This commit is contained in:
Alpamys 2026-03-26 12:46:29 +05:00
parent cbc0a0e558
commit ff88a2c525
2 changed files with 13 additions and 4 deletions

View File

@ -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)",
),
):

View File

@ -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()