Detect lingering threads after tests (#37270)

* Detect lingering threads after tests

* Make sure cast is setup before checking state

* Make sure we ask executors of old hass to shutdown

We are not waiting here, just hoping for the best

* Make sure all instances of hass and executors is stopped.

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Also apply hass stopping to scripts

* Adjust to changes how we set up executor

* Add new CoreState.stopped

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Joakim Plate
2020-07-09 16:15:14 +02:00
committed by GitHub
co-authored by Paulus Schoutsen
parent 08fa701854
commit bcd604eec2
7 changed files with 64 additions and 12 deletions
@@ -552,6 +552,7 @@ async def test_disconnect_on_stop(hass: HomeAssistantType):
async def test_entry_setup_no_config(hass: HomeAssistantType):
"""Test setting up entry with no config.."""
await async_setup_component(hass, "cast", {})
await hass.async_block_till_done()
with patch(
"homeassistant.components.cast.media_player._async_setup_platform",
@@ -567,6 +568,7 @@ async def test_entry_setup_single_config(hass: HomeAssistantType):
await async_setup_component(
hass, "cast", {"cast": {"media_player": {"host": "bla"}}}
)
await hass.async_block_till_done()
with patch(
"homeassistant.components.cast.media_player._async_setup_platform",
@@ -582,6 +584,7 @@ async def test_entry_setup_list_config(hass: HomeAssistantType):
await async_setup_component(
hass, "cast", {"cast": {"media_player": [{"host": "bla"}, {"host": "blu"}]}}
)
await hass.async_block_till_done()
with patch(
"homeassistant.components.cast.media_player._async_setup_platform",
@@ -598,6 +601,7 @@ async def test_entry_setup_platform_not_ready(hass: HomeAssistantType):
await async_setup_component(
hass, "cast", {"cast": {"media_player": {"host": "bla"}}}
)
await hass.async_block_till_done()
with patch(
"homeassistant.components.cast.media_player._async_setup_platform",