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

Function test_include_plugins_false

tests/unittests/tools/test_agent_tool.py:697–730  ·  view source on GitHub ↗

Test that plugins are NOT propagated when include_plugins=False.

()

Source from the content-addressed store, hash-verified

695
696
697def test_include_plugins_false():
698 """Test that plugins are NOT propagated when include_plugins=False."""
699
700 class TrackingPlugin(BasePlugin):
701
702 def __init__(self, name: str):
703 super().__init__(name)
704 self.before_agent_calls = 0
705
706 async def before_agent_callback(self, **kwargs):
707 self.before_agent_calls += 1
708
709 tracking_plugin = TrackingPlugin(name='tracking')
710
711 mock_model = testing_utils.MockModel.create(
712 responses=[function_call_no_schema, 'response1', 'response2']
713 )
714
715 tool_agent = Agent(
716 name='tool_agent',
717 model=mock_model,
718 )
719
720 root_agent = Agent(
721 name='root_agent',
722 model=mock_model,
723 tools=[AgentTool(agent=tool_agent, include_plugins=False)],
724 )
725
726 runner = testing_utils.InMemoryRunner(root_agent, plugins=[tracking_plugin])
727 runner.run('test1')
728
729 # Plugin should only be called for root_agent, not tool_agent.
730 assert tracking_plugin.before_agent_calls == 1
731
732
733@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

runMethod · 0.95
AgentToolClass · 0.90
TrackingPluginClass · 0.85
createMethod · 0.45

Tested by

no test coverage detected