Skip to content

Clarify force_update cancellation test and add no-coordinators noop test#132

Merged
eXPerience83 merged 1 commit into
mainfrom
codex/polish-tests-for-pollenlevels.force_update
May 27, 2026
Merged

Clarify force_update cancellation test and add no-coordinators noop test#132
eXPerience83 merged 1 commit into
mainfrom
codex/polish-tests-for-pollenlevels.force_update

Conversation

@eXPerience83
Copy link
Copy Markdown
Owner

Motivation

  • Make the cancellation regression test contract explicit that the cancellation is per-entry and does not imply swallowing global HA task cancellation.
  • Add missing coverage for the no-op branch when there are no runtime coordinators so the service call is safe in that case.
  • Keep the change test-only and avoid any runtime behavior modifications.

Description

  • Rename the test test_force_update_handles_cancelled_error to test_force_update_handles_per_entry_cancelled_error and update its docstring to """Per-entry cancellation results should not abort the global service.""" in tests/test_init.py.
  • Add a new test test_force_update_no_coordinators_is_noop in tests/test_init.py that sets up an empty hass (no entries), asserts async_setup returns True, calls the pollenlevels.force_update service, and checks the debug log contains No coordinators available for force_update.
  • No files under custom_components/pollenlevels/ or other runtime code were modified.

Testing

  • Ran ruff check --fix --select I tests/test_init.py && ruff check . and the checks passed.
  • Ran black --check . and the check passed.
  • Ran pytest tests/test_init.py and all tests in that file passed (33 passed).
  • Ran full pytest and the entire suite passed (310 passed).

Codex Task

@qodo-code-review
Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the test suite in tests/test_init.py. It renames test_force_update_handles_cancelled_error to test_force_update_handles_per_entry_cancelled_error with an updated docstring, and adds a new test test_force_update_no_coordinators_is_noop to verify that calling force_update when no coordinators are available behaves as a safe no-op. There are no review comments, and I have no feedback to provide.

@eXPerience83 eXPerience83 merged commit 3a9e29c into main May 27, 2026
7 checks passed
@eXPerience83 eXPerience83 deleted the codex/polish-tests-for-pollenlevels.force_update branch May 27, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant