Merge multiple context managers in tests (#48146)

This commit is contained in:
Franck Nijhof
2021-03-27 09:17:15 +01:00
committed by GitHub
parent 79af18a8ab
commit ad13a9295e
33 changed files with 590 additions and 627 deletions

View File

@@ -743,10 +743,9 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
with patch(
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
return_value=fake_state,
):
with assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(hass, light.DOMAIN, config)
await hass.async_block_till_done()
), assert_setup_component(1, light.DOMAIN):
assert await async_setup_component(hass, light.DOMAIN, config)
await hass.async_block_till_done()
state = hass.states.get("light.test")
assert state.state == STATE_ON