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

First pass fixing tests that raise exceptions caught by asyncio.gather #25860

merged 3 commits into from Aug 12, 2019


Copy link

commented Aug 11, 2019

So I realized that we use asyncio.wait at a bunch of places without checking the result. The problem of asyncio.wait is that any exception is lost and cannot be attributed to a certain place. This is bad.

So we should start exchanging asyncio.wait with asyncio.gather, so that exceptions can propagate. Each time we do this, we will catch bugs and tests that were raising during teardown (which is also some flaky tests!)

This PR is a bunch of fixes required for letting tests pass after we start using asyncio.gather inside hass.async_block_till_done .

Eventually I want to phase out the using of asyncio.wait without checking the return values.

Test failures in this pass were caused, among other things by:

  • unmocked attributes being written to storage, crashing the JSON serializer
  • missing persistent_notification.create service

@balloob balloob requested a review from home-assistant/core as a code owner Aug 11, 2019

@project-bot project-bot bot added this to Needs review in Dev Aug 11, 2019


This comment has been minimized.

Copy link

commented Aug 11, 2019

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (demo) you are listed as a codeowner for? Thanks!

@balloob balloob force-pushed the asyncio-gather branch from bea7473 to 0eb6f96 Aug 11, 2019

elupus approved these changes Aug 11, 2019
Copy link

left a comment

Looks good. I suspect we'll start finding a bunch of cancelleded exception on shutdown.

Dev automation moved this from Needs review to Reviewer approved Aug 11, 2019

balloob added 2 commits Aug 12, 2019

@pvizeli pvizeli merged commit 6f357cb into dev Aug 12, 2019

11 checks passed

CI Build #20190812.9 succeeded
CI (FullCheck Mypy) FullCheck Mypy succeeded
CI (FullCheck Pylint) FullCheck Pylint succeeded
CI (Overview CheckFormat) Overview CheckFormat succeeded
CI (Overview Lint) Overview Lint succeeded
CI (Overview Validate) Overview Validate succeeded
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing b8460bb...4052438
codecov/project 94.02% (target 90%)

Dev automation moved this from Reviewer approved to Done Aug 12, 2019

@delete-merged-branch delete-merged-branch bot deleted the asyncio-gather branch Aug 12, 2019

@lock lock bot locked and limited conversation to collaborators Aug 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.