Bugfix windows have a other default loop now (#4195)
* Bugfix windows have a other default loop now * fix handling with 3.4.2 that not support ensure_future * make the same as ensure_future does * fix spell * fix lazy test
This commit is contained in:
parent
c2a5f63b1f
commit
fcf318cf53
2 changed files with 6 additions and 4 deletions
|
@ -352,8 +352,8 @@ def from_config_dict(config: Dict[str, Any],
|
||||||
future.set_exception(exc)
|
future.set_exception(exc)
|
||||||
|
|
||||||
# run task
|
# run task
|
||||||
future = asyncio.Future()
|
future = asyncio.Future(loop=hass.loop)
|
||||||
asyncio.Task(_async_init_from_config_dict(future), loop=hass.loop)
|
hass.loop.create_task(_async_init_from_config_dict(future))
|
||||||
hass.loop.run_until_complete(future)
|
hass.loop.run_until_complete(future)
|
||||||
|
|
||||||
return future.result()
|
return future.result()
|
||||||
|
@ -452,8 +452,8 @@ def from_config_file(config_path: str,
|
||||||
future.set_exception(exc)
|
future.set_exception(exc)
|
||||||
|
|
||||||
# run task
|
# run task
|
||||||
future = asyncio.Future()
|
future = asyncio.Future(loop=hass.loop)
|
||||||
asyncio.Task(_async_init_from_config_file(future), loop=hass.loop)
|
hass.loop.create_task(_async_init_from_config_file(future))
|
||||||
hass.loop.run_until_complete(future)
|
hass.loop.run_until_complete(future)
|
||||||
|
|
||||||
return future.result()
|
return future.result()
|
||||||
|
|
|
@ -368,9 +368,11 @@ class TestComponentsGroup(unittest.TestCase):
|
||||||
# Hide the group
|
# Hide the group
|
||||||
group.set_visibility(self.hass, group_entity_id, False)
|
group.set_visibility(self.hass, group_entity_id, False)
|
||||||
group_state = self.hass.states.get(group_entity_id)
|
group_state = self.hass.states.get(group_entity_id)
|
||||||
|
self.hass.block_till_done()
|
||||||
self.assertTrue(group_state.attributes.get(ATTR_HIDDEN))
|
self.assertTrue(group_state.attributes.get(ATTR_HIDDEN))
|
||||||
|
|
||||||
# Show it again
|
# Show it again
|
||||||
group.set_visibility(self.hass, group_entity_id, True)
|
group.set_visibility(self.hass, group_entity_id, True)
|
||||||
group_state = self.hass.states.get(group_entity_id)
|
group_state = self.hass.states.get(group_entity_id)
|
||||||
|
self.hass.block_till_done()
|
||||||
self.assertIsNone(group_state.attributes.get(ATTR_HIDDEN))
|
self.assertIsNone(group_state.attributes.get(ATTR_HIDDEN))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue