Update Z-Wave to use async_get_integration#23014
Update Z-Wave to use async_get_integration#23014cgarwood merged 3 commits intohome-assistant:devfrom
Conversation
|
Hey there @home-assistant/z-wave, mind taking a look at this pull request as its been labeled with a integration ( |
| self.primary.enable_poll(polling_intensity) | ||
|
|
||
| platform = get_platform(self._hass, component, DOMAIN) | ||
| integration = asyncio.run_coroutine_threadsafe( |
There was a problem hiding this comment.
That is not good, we probably need provide loader.get_integration()
There was a problem hiding this comment.
I may have bit off more than I can chew currently, there's a lot of get_platform mocking in tests that I've never worked with, so it may be better for someone else to take this on
There was a problem hiding this comment.
Nah, we should just replace this code with:
platform = importlib.import_module('.{}'.format(conf[CONF_PLATFORM]),
__name__)There was a problem hiding this comment.
Because integration code shouldn't load an integration object to load its own code.
There was a problem hiding this comment.
And then everywhere in the tests that mock get_platform, mock importlib.import_module
Codecov Report
@@ Coverage Diff @@
## dev #23014 +/- ##
===========================================
- Coverage 93.95% 64.5% -29.46%
===========================================
Files 448 448
Lines 36750 36750
===========================================
- Hits 34529 23704 -10825
- Misses 2221 13046 +10825
Continue to review full report at Codecov.
|
Description:
Update Z-Wave component to use
async_get_integrationinstead ofget_platformRelated issue (if applicable): fixes #23009
Checklist:
tox. Your PR cannot be merged unless tests pass