Properly skip a2a tests if fasta2a not installed

This commit is contained in:
Yiorgis Gozadinos 2025-10-27 11:28:35 +02:00
parent afd4a581fb
commit 4cc25407ef
No known key found for this signature in database
2 changed files with 11 additions and 9 deletions

View file

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

View file

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