Skip to content

test: add unit test increasing coverage for cleanup.py#5793

Open
cheesebee123 wants to merge 2 commits into
google:mainfrom
cheesebee123:fix/cleanup_unittest
Open

test: add unit test increasing coverage for cleanup.py#5793
cheesebee123 wants to merge 2 commits into
google:mainfrom
cheesebee123:fix/cleanup_unittest

Conversation

@cheesebee123
Copy link
Copy Markdown

Problem:
The close_runners utility function located in google.adk.cli.utils.cleanup lacked dedicated unit test coverage to ensure it properly handles and awaits the asynchronous close method on provided runner instances.

Solution:
Added a new asynchronous unit test (test_close_runners_calls_close) using unittest.mock (Mock and AsyncMock) to verify that when close_runners is called, the close method of each runner in the list is successfully awaited exactly once.

Testing Plan:

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

platform win32 -- Python 3.11.14, pytest-9.0.3, pluggy-1.6.0
rootdir: C:\Users\Dr. Puffyapple\Documents\Google_ADK_Unittests\adk-python
configfile: pyproject.toml
plugins: anyio-4.13.0, langsmith-0.8.4, asyncio-1.3.0, cov-7.1.0, mock-3.15.1, xdist-3.8.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 1 item `

tests\unittests\cli\utils\test_cleanup.py . [100%]

============================================================================== 1 passed in 3.37s ==============================================================================

Manual End-to-End (E2E) Tests:

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Add any other context or screenshots about the feature request here.

@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented May 21, 2026

Response from ADK Triaging Agent

Hello @cheesebee123, thank you for creating this PR!

It looks like the header-check status check has failed because the newly added file tests/unittests/cli/utils/test_cleanup.py is missing the Apache 2.0 license header.

Could you please add the license header to tests/unittests/cli/utils/test_cleanup.py? You can run pre-commit run --all-files (or use Google's addlicense tool) to automatically format and add the license headers.

This information will help reviewers to review your PR more efficiently. Thanks!

Added copyright notice and licensing information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants