Cache descriptors on first access#1701
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #1701 +/- ##
==========================================
+ Coverage 81.66% 81.74% +0.08%
==========================================
Files 191 191
Lines 17913 17934 +21
Branches 3843 3845 +2
==========================================
+ Hits 14628 14660 +32
+ Misses 2997 2986 -11
Partials 288 288
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@rytilahti could you review/merge this? |
rytilahti
left a comment
There was a problem hiding this comment.
Looks fairly ready to go to me, please see the comments for some minor issues.
Co-authored-by: Teemu R. <tpr@iki.fi>
|
@rytilahti the tests are actually succesfull, there is an error uploading the codecov.... |
| mocker.patch("miio.Device._sensor_descriptors_from_status", return_value={}) | ||
| mocker.patch("miio.Device._setting_descriptors_from_status", return_value={}) | ||
| mocker.patch("miio.Device._action_descriptors", return_value={}) | ||
| for _i in range(5): |
There was a problem hiding this comment.
Just for the future, the proper way to do this is to use plain _ here. No need to fix that now though.
|
@rytilahti all tests have passed |
The descriptors accessed through
sensors(),settings(), andactions()are now cached on the first use to avoid unnecessary I/O.follow up on PR #1592 which got merge conflicts and is closed.