Skip to content
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

Merged
merged 2 commits into from Feb 27, 2018
Merged

Conversation

kellerza
Copy link
Member

Description:

Getting: sys:1: RuntimeWarning: coroutine 'mock_coro' was never awaited after #12509

Seems 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

    'homeassistant.bootstrap.async_enable_logging',  # callback
    'homeassistant.bootstrap.clear_secret_cache',
    'homeassistant.bootstrap.async_register_signal_handling',  # callback
    'homeassistant.config.process_ha_config_upgrade',

@homeassistant homeassistant added cla-signed core small-pr PRs with less than 30 lines. labels Feb 26, 2018

async def mock_coro(*args):
"""Coroutine that returns None."""
@callback

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())
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

@balloob balloob merged commit 6ed7656 into home-assistant:dev Feb 27, 2018
@balloob balloob mentioned this pull request Mar 9, 2018
@kellerza kellerza deleted the check_config_async branch March 18, 2018 20:06
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed core small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants