From 59d57cb2fb668d31133b1b890c0fc72d300af245 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 06:58:05 +0000 Subject: [PATCH] fix: add starlette/httpx to dev deps, guard test_openai_compat imports - Add starlette>=0.36 and httpx>=0.27 to dev dependencies so test_openai_compat.py can run in dev environments - Add pytest.importorskip guards for starlette and fastapi so the test file is skipped gracefully when those packages are missing - Fix import sorting (ruff I001) 340 tests now pass (was 325 with test_openai_compat skipped). Co-Authored-By: Nakamoto, S --- pyproject.toml | 2 ++ tests/test_openai_compat.py | 27 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 596e8bf..169cea6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]"] diff --git a/tests/test_openai_compat.py b/tests/test_openai_compat.py index 572b392..699ff82 100644 --- a/tests/test_openai_compat.py +++ b/tests/test_openai_compat.py @@ -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 = {