Rework chromecast fix (#16804)
* Revert changes of #16471, and fix the platform setup issue * Fix unit test * Fix * Fix comment * Fix test * Address review comment * Address review comment
This commit is contained in:
parent
329d9dfc06
commit
564ad7e22a
3 changed files with 37 additions and 13 deletions
|
@ -609,16 +609,18 @@ def patch_yaml_files(files_dict, endswith=True):
|
|||
return patch.object(yaml, 'open', mock_open_f, create=True)
|
||||
|
||||
|
||||
def mock_coro(return_value=None):
|
||||
"""Return a coro that returns a value."""
|
||||
return mock_coro_func(return_value)()
|
||||
def mock_coro(return_value=None, exception=None):
|
||||
"""Return a coro that returns a value or raise an exception."""
|
||||
return mock_coro_func(return_value, exception)()
|
||||
|
||||
|
||||
def mock_coro_func(return_value=None):
|
||||
def mock_coro_func(return_value=None, exception=None):
|
||||
"""Return a method to create a coro function that returns a value."""
|
||||
@asyncio.coroutine
|
||||
def coro(*args, **kwargs):
|
||||
"""Fake coroutine."""
|
||||
if exception:
|
||||
raise exception
|
||||
return return_value
|
||||
|
||||
return coro
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue