test(inference): skip 3 CLI tests when FastAPI is absent

The ubuntu-latest py3.11 matrix cell doesn't install the [serve] extra,
so `soup serve` exits early with a FastAPI-missing message before
reaching --structured-output / --auto-quant / --json-schema validation.
Add `pytest.importorskip("fastapi")` to the three tests that exercise
those CLI-level validation paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alpamys 2026-04-24 23:47:19 +05:00
parent e509614a9f
commit 4faf5fc933
1 changed files with 3 additions and 0 deletions

View File

@ -816,6 +816,7 @@ class TestTracingExtra:
class TestStructuredOutputExtra:
def test_cli_json_without_schema_errors(self, tmp_path):
"""--structured-output json must require --json-schema."""
pytest.importorskip("fastapi") # CLI exits early w/o FastAPI
from typer.testing import CliRunner
from soup_cli.cli import app
@ -843,6 +844,7 @@ class TestStructuredOutputExtra:
class TestAutoQuantCLIWarning:
def test_auto_quant_prints_deferral_warning(self, tmp_path):
"""--auto-quant must print a yellow warning explaining it's a no-op."""
pytest.importorskip("fastapi") # CLI exits early w/o FastAPI
from typer.testing import CliRunner
from soup_cli.cli import app
@ -871,6 +873,7 @@ class TestAutoQuantCLIWarning:
class TestJsonSchemaContainment:
def test_json_schema_outside_cwd_rejected(self, tmp_path, monkeypatch):
"""JSON schema path must stay under cwd."""
pytest.importorskip("fastapi") # CLI exits early w/o FastAPI
from typer.testing import CliRunner
from soup_cli.cli import app