chore: Make UT of a2a consistent about how tests should be skipped when python verison < 3.10

PiperOrigin-RevId: 801040421
This commit is contained in:
Xiang (Sean) Zhou
2025-08-29 14:59:27 -07:00
committed by Copybara-Service
parent 2eddc5e4d3
commit 98b0426cd2
11 changed files with 197 additions and 323 deletions
@@ -54,39 +54,10 @@ try:
from google.adk.tools.example_tool import ExampleTool
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
AgentCapabilities = DummyTypes()
AgentCard = DummyTypes()
AgentProvider = DummyTypes()
AgentSkill = DummyTypes()
SecurityScheme = DummyTypes()
AgentCardBuilder = DummyTypes()
BaseAgent = DummyTypes()
LlmAgent = DummyTypes()
LoopAgent = DummyTypes()
ParallelAgent = DummyTypes()
SequentialAgent = DummyTypes()
ExampleTool = DummyTypes()
# Dummy functions
_build_agent_description = lambda x: ""
_build_llm_agent_description_with_instructions = lambda x: ""
_build_orchestration_skill = lambda x, y: None
_build_parallel_description = lambda x: ""
_build_sequential_description = lambda x: ""
_build_loop_description = lambda x: ""
_convert_example_tool_examples = lambda x: []
_extract_examples_from_instruction = lambda x: None
_get_agent_skill_name = lambda x: ""
_get_agent_type = lambda x: ""
_get_default_description = lambda x: ""
_get_input_modes = lambda x: None
_get_output_modes = lambda x: None
_get_workflow_description = lambda x: None
_replace_pronouns = lambda x: ""
# Imports are not needed since tests will be skipped due to pytestmark.
# The imported names are only used within test methods, not at module level,
# so no NameError occurs during module compilation.
pass
else:
raise e