Skip to content

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

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

test: add unit test increasing coverage for cleanup.py#5793
cheesebee123 wants to merge 7 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

adk-bot commented May 21, 2026

Copy link
Copy Markdown
Collaborator

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.
@rohityan rohityan self-assigned this May 26, 2026
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label May 26, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @cheesebee123 , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@cheesebee123 cheesebee123 force-pushed the fix/cleanup_unittest branch from 116b653 to 2915993 Compare May 28, 2026 17:25
@rohityan rohityan added needs review [Status] The PR/issue is awaiting review from the maintainer and removed request clarification [Status] The maintainer need clarification or more information from the author labels May 29, 2026
@rohityan rohityan requested a review from wyf7107 May 29, 2026 19:22
@rohityan rohityan added the core [Component] This issue is related to the core interface and implementation label May 29, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @wyf7107 , can you please review this.

@boyangsvl boyangsvl added the ready to pull [Status] This PR is ready to be imported back to Google label Jun 12, 2026
@lkang172 lkang172 self-assigned this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer ready to pull [Status] This PR is ready to be imported back to Google

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants