test(zwave_js): use patch.object instead of monkeypatch for runtime_data#1281
Merged
Conversation
Convert the three _get_client_state readiness tests off the pytest monkeypatch fixture to unittest.mock.patch.object, matching the patching style used elsewhere in the suite. Behaviorally identical -- both set and restore runtime_data on the lock's config entry -- and scopes the patch to the call under test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1281 +/- ##
=======================================
Coverage 97.10% 97.10%
=======================================
Files 54 54
Lines 6553 6553
Branches 460 460
=======================================
Hits 6363 6363
Misses 190 190
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed change
Convert the three
_get_client_statereadiness tests intests/providers/zwave_js/test_provider.pyoff the pytestmonkeypatchfixture tounittest.mock.patch.object, matching the patching style used elsewhere in the suite.The change is behaviorally identical -- both set and then restore
runtime_dataon the lock's config entry -- and scopes the patch to the call under test via awithblock. Split out of the #1279 review follow-up to keep that PR focused.Type of change
Additional information
🤖 Generated with Claude Code