Merge pull request 'fix: add starlette/httpx to dev deps, guard test_openai_compat imports' (#2) from devin/1777359479-fix-openai-compat-tests into main
Some checks failed
Tests / test (3.10) (push) Failing after 39s
Tests / test (3.11) (push) Failing after 36s
Tests / test (3.12) (push) Successful in 38s
Tests / lint (push) Successful in 34s
Tests / docker (push) Successful in 1m45s

This commit was merged in pull request #2.
This commit is contained in:
2026-04-28 08:19:12 +00:00
2 changed files with 21 additions and 8 deletions

View File

@@ -35,6 +35,8 @@ dev = [
"pytest>=7.4",
"mypy>=1.8",
"ruff>=0.4",
"starlette>=0.36",
"httpx>=0.27",
]
all = ["fusionagi[openai,anthropic,local,gpu]"]

View File

@@ -1,20 +1,31 @@
"""Tests for OpenAI-compatible API bridge."""
"""Tests for OpenAI-compatible API bridge.
Requires the ``api`` or ``dev`` extra (starlette, httpx).
Skipped gracefully when those packages are not installed.
"""
import json
import os
import pytest
from starlette.testclient import TestClient
from fusionagi.adapters import StubAdapter
from fusionagi.api.app import create_app
from fusionagi.api.openai_compat.translators import (
messages_to_prompt,
pytest.importorskip("starlette", reason="starlette not installed (pip install fusionagi[dev])")
pytest.importorskip("fastapi", reason="fastapi not installed (pip install fusionagi[api])")
from starlette.testclient import TestClient # noqa: E402
from fusionagi.adapters import StubAdapter # noqa: E402
from fusionagi.api.app import create_app # noqa: E402
from fusionagi.api.openai_compat.translators import ( # noqa: E402
estimate_usage,
final_response_to_openai,
messages_to_prompt,
)
from fusionagi.schemas.witness import ( # noqa: E402
AgreementMap,
FinalResponse,
TransparencyReport,
)
from fusionagi.schemas.witness import AgreementMap, FinalResponse, TransparencyReport
# Stub adapter responses for Dvādaśa heads and Witness
HEAD_OUTPUT = {