getting asyncio.exceptions.CancelledError when running pytest evalation for agent which uses mcptoolset
My agent is using mcptoolset, and my test looks like this @pytest.mark.asyncio async def test_with_simple_trajectory(): """Test the agent's basic ability via a session file."""
await AgentEvaluator.evaluate(
agent_module="repo_navigator",
eval_dataset_file_path_or_dir="tests/integration/test_files/simple_trajectory/simple_tractory_test.json",
print_detailed_results=True,
)
it fails with _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fut = <Task cancelled name='Task-35' coro=<ClientSession.list_tools() done, defined at C:\learning\Repo-Navigator-AI.venv\Lib\site-packages\mcp\client\session.py:473>>
loop =
async def _cancel_and_wait(fut, loop):
"""Cancel the *fut* future or task and wait until it completes."""
waiter = loop.create_future()
cb = functools.partial(_release_waiter, waiter)
fut.add_done_callback(cb)
try:
fut.cancel()
# We cannot wait on *fut* directly to make
# sure _cancel_and_wait itself is reliably cancellable.
await waiter
E asyncio.exceptions.CancelledError: Cancelled via cancel scope 28719010b10 by <Task pending name='Task-22' coro=<McpToolset.close() running at C:\learning\Repo-Navigator-AI.venv\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py:217> cb=[_release_waiter(<Future pendi...ask_wakeup()]>)() at C:\Users\vanda\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py:431]>
C:\Users\vanda\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py:562: CancelledError, is this a known issue?
This is not a known issue.
Can you please provide following details:
- which ADK version are you running?
- Does the issue happen every time or is it flaky?
- Can you provide full stack trace (excluding calls to your code)?
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
This has been automatically closed because it has been marked as stale for over 7 days.