From 4cc25407efdc73e1fa0c6b8655e9cfb523f623f9 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Mon, 27 Oct 2025 11:28:35 +0200 Subject: [PATCH] Properly skip a2a tests if fasta2a not installed --- tests/test_a2a.py | 18 +++++++++--------- tests/test_app.py | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_a2a.py b/tests/test_a2a.py index c0b34817..db81dd1d 100644 --- a/tests/test_a2a.py +++ b/tests/test_a2a.py @@ -2,15 +2,6 @@ import uuid import pytest -from haiku.rag.a2a import ( - extract_question_from_task, - get_agent_skills, - load_message_history, - save_message_history, -) -from haiku.rag.a2a.storage import LRUMemoryStorage -from haiku.rag.client import HaikuRAG - pytest.importorskip("fasta2a") from fasta2a.schema import Message, TextPart # noqa: E402 @@ -25,6 +16,15 @@ from pydantic_ai.messages import ( TextPart as AITextPart, ) +from haiku.rag.a2a import ( + extract_question_from_task, + get_agent_skills, + load_message_history, + save_message_history, +) +from haiku.rag.a2a.storage import LRUMemoryStorage +from haiku.rag.client import HaikuRAG + @pytest.mark.asyncio async def test_save_and_load_message_history(): diff --git a/tests/test_app.py b/tests/test_app.py index 451e7026..b6111ddc 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -255,6 +255,7 @@ async def test_serve_monitor_only(app: HaikuRAGApp, monkeypatch): @pytest.mark.asyncio async def test_serve_a2a_only(app: HaikuRAGApp, monkeypatch): """Test the serve method with A2A server only.""" + pytest.importorskip("fasta2a") created_tasks = [] original_create_task = asyncio.create_task @@ -287,6 +288,7 @@ async def test_serve_a2a_only(app: HaikuRAGApp, monkeypatch): @pytest.mark.asyncio async def test_serve_all_services(app: HaikuRAGApp, monkeypatch): """Test the serve method with all services enabled.""" + pytest.importorskip("fasta2a") created_tasks = [] original_create_task = asyncio.create_task