Skip to content

Add comprehensive tests for various components in the agentflow.storage and publisher modulesre#131

Open
Iamsdt wants to merge 1 commit into
mainfrom
feat/test-improve
Open

Add comprehensive tests for various components in the agentflow.storage and publisher modulesre#131
Iamsdt wants to merge 1 commit into
mainfrom
feat/test-improve

Conversation

@Iamsdt

@Iamsdt Iamsdt commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator
  • Enhance test coverage for agent retry fallback with additional cases for non-integer and None status codes.
  • Introduce tests for CompositePublisher lifecycle, including adding, publishing, and removing publishers.
  • Implement tests for KafkaPublisher and RabbitMQPublisher to handle closed states and error scenarios.
  • Add tests for publishing events and managing background tasks.
  • Create a ConcreteMediaStore for testing media storage functionalities, including metadata retrieval and existence checks.
  • Extend MediaRefResolver tests to cover legacy reference handling and transport modes.
  • Implement ProviderMediaCache tests to validate caching behavior and eviction logic.
  • Add tests for Google and OpenAI API call implementations to ensure correct parameter handling and response processing.

…ge and publisher modules

- Enhance test coverage for agent retry fallback with additional cases for non-integer and None status codes.
- Introduce tests for CompositePublisher lifecycle, including adding, publishing, and removing publishers.
- Implement tests for KafkaPublisher and RabbitMQPublisher to handle closed states and error scenarios.
- Add tests for publishing events and managing background tasks.
- Create a ConcreteMediaStore for testing media storage functionalities, including metadata retrieval and existence checks.
- Extend MediaRefResolver tests to cover legacy reference handling and transport modes.
- Implement ProviderMediaCache tests to validate caching behavior and eviction logic.
- Add tests for Google and OpenAI API call implementations to ensure correct parameter handling and response processing.
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment on lines +15 to +36
# def missing_a2a_sdk_error(feature: str, exc: BaseException) -> RuntimeError:
# """Return a consistent error for A2A helpers when a2a-sdk is absent."""
# return RuntimeError(
# f"{feature} requires the optional 'a2a-sdk' package. {A2A_EXTRA_INSTALL_HINT}"
# )


def import_a2a_module(module_name: str, feature: str) -> ModuleType:
"""Import an A2A SDK module with a helpful optional-dependency error."""
try:
return import_module(module_name)
except Exception as exc:
raise missing_a2a_sdk_error(feature, exc) from exc
# def import_a2a_module(module_name: str, feature: str) -> ModuleType:
# """Import an A2A SDK module with a helpful optional-dependency error."""
# try:
# return import_module(module_name)
# except Exception as exc:
# raise missing_a2a_sdk_error(feature, exc) from exc


def get_a2a_attr(module_name: str, attr_name: str, feature: str) -> Any:
"""Get an attribute from an A2A SDK module with a consistent error."""
module = import_a2a_module(module_name, feature)
try:
return getattr(module, attr_name)
except AttributeError as exc:
raise missing_a2a_sdk_error(feature, exc) from exc
# def get_a2a_attr(module_name: str, attr_name: str, feature: str) -> Any:
# """Get an attribute from an A2A SDK module with a consistent error."""
# module = import_a2a_module(module_name, feature)
# try:
# return getattr(module, attr_name)
# except AttributeError as exc:
# raise missing_a2a_sdk_error(feature, exc) from exc
@@ -0,0 +1,108 @@
import pytest
from unittest.mock import MagicMock, AsyncMock, patch

import pytest
from unittest.mock import AsyncMock, MagicMock, patch
from typing import Any
import pytest
from unittest.mock import AsyncMock, MagicMock, patch
from typing import Any
from pathlib import Path
create_eval_app,
create_simple_eval_set,
)
from agentflow.qa.evaluation.eval_result import EvalReport
create_simple_eval_set,
)
from agentflow.qa.evaluation.eval_result import EvalReport
from agentflow.core.graph.compiled_graph import CompiledGraph
from unittest.mock import AsyncMock, MagicMock, patch
from typing import Any
import json
import uuid
Comment on lines +9 to +14
from agentflow.qa.evaluation.simulators.user_simulator import (
UserSimulator,
BatchSimulator,
ConversationScenario,
SimulationResult
)

# 2. With cached content (system prompt should be ignored)
mock_client.aio.models.generate_content.reset_mock()
res = await _call_google(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant