-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Removing asyncio.coroutine syntax from HASS core #12509
Conversation
For the test that failed on config entries, try swapping the two decorators around in config/config_entries.py line 100 (or convert to async/await) |
@@ -569,8 +568,7 @@ def async_will_remove_from_hass(self): | |||
self._async_unsub_state_changed() | |||
self._async_unsub_state_changed = None | |||
|
|||
@asyncio.coroutine | |||
def _async_state_changed_listener(self, entity_id, old_state, new_state): | |||
async def _async_state_changed_listener(self, entity_id, old_state, new_state): |
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.
line too long (83 > 79 characters)
@@ -569,8 +568,7 @@ def async_will_remove_from_hass(self): | |||
self._async_unsub_state_changed() | |||
self._async_unsub_state_changed = None | |||
|
|||
@asyncio.coroutine | |||
def _async_state_changed_listener(self, entity_id, old_state, new_state): | |||
async def _async_state_changed_listener(self, entity_id, old_state, new_state): |
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.
line too long (83 > 79 characters)
Please limit changes to code that is covered by tests (but do not update the tests in the same PR). |
This is not only core changes. Please update PR title. |
@balloob : how should I handle linting problems within components? (pylint complained at various places that a function from core is (no longer) iterable? I made the functions async where the complexity is low and added a pylint ignore where I saw the risk of breaking something. I'm also not sure how to handle failed unit tests... |
You will have to fix the unit tests.. |
c7e5d3e
to
eee2f44
Compare
@RequestDataValidator(vol.Schema({ | ||
vol.Required('domain'): str, | ||
})) | ||
@asyncio.coroutine |
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.
Since this is covered by tests, we could also just add async
keyword to function.
homeassistant/requirements.py
Outdated
@@ -24,9 +23,9 @@ def async_process_requirements(hass, name, requirements): | |||
pip_install = partial(pkg_util.install_package, | |||
**pip_kwargs(hass.config.config_dir)) | |||
|
|||
with (yield from pip_lock): | |||
with (await pip_lock): |
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.
I think that this can be replaced with async with pip_lock:
Okay I addressed my own comment and fixed the merge conflict, however the logging test still fails. I am unable to repro it locally on Python 3.5.3 🤔 This is why smaller PRs will help, makes it easy to see why something is causing an error. |
regarding
I fixed this test by doing: diff --git a/tests/util/test_logging.py b/tests/util/test_logging.py
index 94c8568..c67b2ae 100644
--- a/tests/util/test_logging.py
+++ b/tests/util/test_logging.py
@@ -6,7 +6,6 @@ import threading
import homeassistant.util.logging as logging_util
-@asyncio.coroutine
def test_sensitive_data_filter():
"""Test the logging sensitive data filter."""
log_filter = logging_util.HideSensitiveDataFilter('mock_sensitive') (and JFTR: the flaky test_pilight.py test is already flaky on current dev ) |
Description
Changed old
asyncio.coroutine
/yield from
syntax toasync def
/await
syntax within core libraries.Current state
Runs here on my home on production without problems.
13 unit tests fail.