MCPcopy Index your code
hub / github.com/google/adk-python / temp_agents_dir_with_a2a

Function temp_agents_dir_with_a2a

tests/unittests/cli/test_fast_api.py:814–845  ·  view source on GitHub ↗

Create a temporary agents directory with A2A agent configurations for testing.

()

Source from the content-addressed store, hash-verified

812
813@pytest.fixture
814def temp_agents_dir_with_a2a():
815 """Create a temporary agents directory with A2A agent configurations for testing."""
816 with tempfile.TemporaryDirectory() as temp_dir:
817 # Create test agent directory
818 agent_dir = Path(temp_dir) / "test_a2a_agent"
819 agent_dir.mkdir()
820
821 # Create agent.json file
822 agent_card = {
823 "name": "test_a2a_agent",
824 "description": "Test A2A agent",
825 "version": "1.0.0",
826 "author": "test",
827 "capabilities": ["text"],
828 }
829
830 with open(agent_dir / "agent.json", "w") as f:
831 json.dump(agent_card, f)
832
833 # Create a simple agent.py file
834 agent_py_content = """
835from google.adk.agents.base_agent import BaseAgent
836
837class TestA2AAgent(BaseAgent):
838 def __init__(self):
839 super().__init__(name="test_a2a_agent")
840"""
841
842 with open(agent_dir / "agent.py", "w") as f:
843 f.write(agent_py_content)
844
845 yield temp_dir
846
847
848@pytest.fixture

Callers

nothing calls this directly

Calls 2

openFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected