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
Check_config await error #12722
Check_config await error #12722
Conversation
|
||
async def mock_coro(*args): | ||
"""Coroutine that returns None.""" | ||
@callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
@@ -246,7 +248,7 @@ def mock_logger_exception_bootstrap(msg, *params): | |||
|
|||
# Patches to skip functions | |||
for sil in SILENCE: | |||
PATCHES[sil] = patch(sil, return_value=mock_coro()) | |||
PATCHES[sil] = patch(sil, return_value=mock_cb()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work for async functions. Async functions need to return a coro. So you will need 2 SILENCE groups. Ones that are callbacks, ones that are not. Both need to be patched accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today we only have regular functions and @callbacks, no async def
or @coroutines.
I commented the functions as callbacks, but can add a note to this effect?
Also working at not using bootstrap.py
at all anymore, so can hopefully get rid of these soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. you're right.
Description:
Getting:
sys:1: RuntimeWarning: coroutine 'mock_coro' was never awaited
after #12509Seems to be cause primarily caused by the patch of 'homeassistant.bootstrap.async_enable_logging'
but both async_ methods being patched are callbacks and not coroutines, I marked them as such