-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert common fixtures to plain functions #221
Merged
Merged
Conversation
This file contains 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #221 +/- ##
=======================================
Coverage 96.40% 96.40%
=======================================
Files 61 61
Lines 9359 9359
=======================================
Hits 9023 9023
Misses 336 336 ☔ View full report in Codecov by Sentry. |
puddly
changed the title
Convert
Convert common fixtures to plain functions
Oct 3, 2024
zha_device_from_file
and device_joined
fixtures to functions
dmulcahey
approved these changes
Oct 3, 2024
dmulcahey
reviewed
Oct 3, 2024
This reverts commit 1f764e2.
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.
The dependency chains created by pytest fixtures unfortunately make selectively applying fixtures (or figuring out how they work at times) difficult. I've converted the following fixtures to normal functions that usually operate on a single
Gateway
object:zha_device_from_file
->zigpy_device_from_device_data
andzigpy_device_from_json
device_joined
->join_zigpy_device
zigpy_device_mock
->create_mock_zigpy_device
Going forward, I think mock devices created within fixtures should ideally be replaced with real device mocks created from JSON dumps.