chore: skip mcp and a2a tests for python 3.9

PiperOrigin-RevId: 773785385
This commit is contained in:
Xiang (Sean) Zhou
2025-06-20 11:46:31 -07:00
committed by Copybara-Service
parent 2f716ada7f
commit ffcba70686
4 changed files with 122 additions and 37 deletions
@@ -13,18 +13,43 @@
# limitations under the License.
import json
import sys
from unittest.mock import Mock
from unittest.mock import patch
from a2a import types as a2a_types
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_KEY
from google.adk.a2a.converters.part_converter import convert_a2a_part_to_genai_part
from google.adk.a2a.converters.part_converter import convert_genai_part_to_a2a_part
from google.genai import types as genai_types
import pytest
# Skip all tests in this module if Python version is less than 3.10
pytestmark = pytest.mark.skipif(
sys.version_info < (3, 10), reason="A2A tool requires Python 3.10+"
)
# Import dependencies with version checking
try:
from a2a import types as a2a_types
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
from google.adk.a2a.converters.part_converter import A2A_DATA_PART_METADATA_TYPE_KEY
from google.adk.a2a.converters.part_converter import convert_a2a_part_to_genai_part
from google.adk.a2a.converters.part_converter import convert_genai_part_to_a2a_part
from google.genai import types as genai_types
except ImportError as e:
if sys.version_info < (3, 10):
# Create dummy classes to prevent NameError during test collection
# Tests will be skipped anyway due to pytestmark
class DummyTypes:
pass
a2a_types = DummyTypes()
genai_types = DummyTypes()
A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL = "function_call"
A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE = "function_response"
A2A_DATA_PART_METADATA_TYPE_KEY = "type"
convert_a2a_part_to_genai_part = lambda x: None
convert_genai_part_to_a2a_part = lambda x: None
else:
raise e
class TestConvertA2aPartToGenaiPart:
"""Test cases for convert_a2a_part_to_genai_part function."""