Fix shelly tests - mock async_unload_entry#166851
Merged
frenck merged 1 commit intoMar 30, 2026
Merged
Conversation
21 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Shelly test fixtures to fully stub config entry lifecycle during config flow tests, preventing teardown failures when entry.runtime_data is not initialized.
Changes:
- Extend the
mock_setup_entryfixture to also patchhomeassistant.components.shelly.async_unload_entry. - Update the fixture docstring to reflect the expanded patching behavior.
Contributor
|
Hey there @bieniu, @thecode, @chemelli74, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
frenck
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Split out from #166683 which tries to fix the flaky tests in the shelly integration. This PR focuses on the
mock_setup_entryfixture, which didn't patchasync_unload_entrybefore. This caused an error on test teardown becauseentry.runtime_datawasn't initialized.entry.runtime_datadoesn't exist because flow tests usemock_setup_entryto skip the real integration setup.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: