Skip to content

Add regression tests for issue #306 zone toggle#399

Merged
sebr merged 1 commit intomainfrom
tests-issue-306-change-mode-regression
Apr 19, 2026
Merged

Add regression tests for issue #306 zone toggle#399
sebr merged 1 commit intomainfrom
tests-issue-306-change-mode-regression

Conversation

@sebr
Copy link
Copy Markdown
Owner

@sebr sebr commented Apr 19, 2026

Summary

  • Pin the event sequence reported in Zone Switch toggles when program Runs #306 with coordinator and valve-level tests.
  • In the old switch-based zone entity, a change_mode with mode=auto (which B-hyve emits ~1s after watering_in_progress_notification at program start) set is_on = False on every zone, producing the visible on/off toggle.
  • The valve migration in #232: Breaking: convert from switch entities to valve entities #240 moved state derivation to the coordinator — EVENT_CHANGE_MODE now only merges new keys onto status and never touches watering_status. The scenario was never pinned by tests; this PR adds them.

Test plan

  • pytest tests/test_coordinator.py::TestDeviceEventHandling -v
  • pytest tests/test_valve.py::test_valve_does_not_toggle_on_change_mode_during_watering -v
  • pytest tests/ (152 passed, 5 skipped)

The old switch-based zone entity closed itself on a `change_mode` event
with `mode=auto`, which the B-hyve cloud emits right after
`watering_in_progress_notification` when a program starts. The migration
to valve entities (PR #240) moved state derivation to the coordinator,
but the scenario was never pinned by tests.

Replay the event sequence from the issue log against the real
coordinator and assert the valve stays open across the interleaved
`change_mode` and closes cleanly on `device_idle`.
@sebr sebr merged commit d3f1bd2 into main Apr 19, 2026
4 checks passed
@sebr sebr deleted the tests-issue-306-change-mode-regression branch April 19, 2026 09:20
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.

1 participant