Skip to content

Add tests asserting condition features#168881

Merged
MartinHjelmare merged 1 commit into
devfrom
improve_condition_tests
Apr 24, 2026
Merged

Add tests asserting condition features#168881
MartinHjelmare merged 1 commit into
devfrom
improve_condition_tests

Conversation

@emontnemery
Copy link
Copy Markdown
Contributor

@emontnemery emontnemery commented Apr 23, 2026

Proposed change

Add tests asserting condition features

This extends #168731 to other conditions: Make sure we don't accidentally add or remove features in concrete condition classes when modifying the base classes

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the “condition options/feature contract” test coverage across many entity condition platforms, ensuring concrete condition classes keep (or intentionally change) support for options like behavior and for when base classes evolve.

Changes:

  • Add new parametrized tests per condition platform asserting which options are accepted/rejected via assert_condition_options_supported.
  • Cover a wide set of condition domains (state-based, cover-derived, and numerical threshold-based) under Labs preview features.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/components/window/test_condition.py Add options-support assertions for window.is_open/is_closed.
tests/components/water_heater/test_condition.py Add options-support assertions for water_heater.is_on/is_off.
tests/components/valve/test_condition.py Add options-support assertions for valve.is_open/is_closed.
tests/components/vacuum/test_condition.py Add options-support assertions for vacuum activity conditions.
tests/components/update/test_condition.py Add options-support assertions for update availability conditions.
tests/components/todo/test_condition.py Add options-support assertions for todo.all_completed.
tests/components/timer/test_condition.py Add options-support assertions for timer status conditions.
tests/components/text/test_condition.py Add options-support assertions for text.is_equal_to.
tests/components/temperature/test_condition.py Add options-support assertions for temperature.is_value (threshold options).
tests/components/switch/test_condition.py Add options-support assertions for switch.is_on/is_off.
tests/components/siren/test_condition.py Add options-support assertions for siren.is_on/is_off.
tests/components/select/test_condition.py Add options-support assertions for select.is_option_selected.
tests/components/schedule/test_condition.py Add options-support assertions for schedule.is_on/is_off.
tests/components/remote/test_condition.py Add options-support assertions for remote.is_on/is_off.
tests/components/power/test_condition.py Add options-support assertions for power.is_value (threshold options).
tests/components/occupancy/test_condition.py Add options-support assertions for occupancy conditions.
tests/components/motion/test_condition.py Add options-support assertions for motion conditions.
tests/components/moisture/test_condition.py Add options-support assertions for moisture conditions.
tests/components/media_player/test_condition.py Add options-support assertions for media player conditions.
tests/components/lock/test_condition.py Add options-support assertions for lock state conditions.
tests/components/light/test_condition.py Add options-support assertions for light.is_on/is_off.
tests/components/lawn_mower/test_condition.py Add options-support assertions for lawn mower activity conditions.
tests/components/illuminance/test_condition.py Add options-support assertions for illuminance conditions.
tests/components/humidity/test_condition.py Add options-support assertions for humidity.is_value (threshold options).
tests/components/humidifier/test_condition.py Add options-support assertions for humidifier state/action conditions.
tests/components/gate/test_condition.py Add options-support assertions for gate.is_open/is_closed.
tests/components/garage_door/test_condition.py Add options-support assertions for garage_door.is_open/is_closed.
tests/components/fan/test_condition.py Add options-support assertions for fan.is_on/is_off.
tests/components/door/test_condition.py Add options-support assertions for door.is_open/is_closed.
tests/components/cover/test_condition.py Add options-support assertions for multiple cover device-class conditions.
tests/components/counter/test_condition.py Add options-support assertions for counter.is_value (threshold options).
tests/components/climate/test_condition.py Add options-support assertions for key climate conditions.
tests/components/calendar/test_condition.py Add options-support assertions for calendar.is_event_active.
tests/components/battery/test_condition.py Add options-support assertions for battery-related conditions.
tests/components/assist_satellite/test_condition.py Add options-support assertions for assist satellite state conditions.
tests/components/alarm_control_panel/test_condition.py Add options-support assertions for alarm control panel conditions.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

The PR description is incorrect. It talks about air quality.

@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft April 23, 2026 09:44
@emontnemery emontnemery marked this pull request as ready for review April 23, 2026 19:00
@home-assistant home-assistant Bot requested a review from MartinHjelmare April 23, 2026 19:00
@MartinHjelmare MartinHjelmare merged commit aad93fd into dev Apr 24, 2026
72 checks passed
@MartinHjelmare MartinHjelmare deleted the improve_condition_tests branch April 24, 2026 16:41
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants