mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -76,6 +76,7 @@ async def test_state_via_state_topic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -112,6 +113,7 @@ async def test_opening_and_closing_state_via_custom_state_payload(hass, mqtt_moc
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -152,6 +154,7 @@ async def test_open_closed_state_from_position_optimistic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -199,6 +202,7 @@ async def test_position_via_position_topic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -236,6 +240,7 @@ async def test_state_via_template(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -267,6 +272,7 @@ async def test_position_via_template(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -301,6 +307,7 @@ async def test_optimistic_state_change(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -358,6 +365,7 @@ async def test_optimistic_state_change_with_position(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -419,6 +427,7 @@ async def test_send_open_cover_command(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -447,6 +456,7 @@ async def test_send_close_cover_command(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -475,6 +485,7 @@ async def test_send_stop__cover_command(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -507,6 +518,7 @@ async def test_current_cover_position(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state_attributes_dict = hass.states.get("cover.test").attributes
|
||||
assert not (ATTR_CURRENT_POSITION in state_attributes_dict)
|
||||
@@ -557,6 +569,7 @@ async def test_current_cover_position_inverted(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state_attributes_dict = hass.states.get("cover.test").attributes
|
||||
assert not (ATTR_CURRENT_POSITION in state_attributes_dict)
|
||||
@@ -613,6 +626,7 @@ async def test_optimistic_position(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state is None
|
||||
@@ -638,6 +652,7 @@ async def test_position_update(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state_attributes_dict = hass.states.get("cover.test").attributes
|
||||
assert not (ATTR_CURRENT_POSITION in state_attributes_dict)
|
||||
@@ -675,6 +690,7 @@ async def test_set_position_templated(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -706,6 +722,7 @@ async def test_set_position_untemplated(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -737,6 +754,7 @@ async def test_set_position_untemplated_custom_percentage_range(hass, mqtt_mock)
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -766,6 +784,7 @@ async def test_no_command_topic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("cover.test").attributes["supported_features"] == 240
|
||||
|
||||
@@ -787,6 +806,7 @@ async def test_no_payload_stop(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("cover.test").attributes["supported_features"] == 3
|
||||
|
||||
@@ -810,6 +830,7 @@ async def test_with_command_topic_and_tilt(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("cover.test").attributes["supported_features"] == 251
|
||||
|
||||
@@ -834,6 +855,7 @@ async def test_tilt_defaults(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state_attributes_dict = hass.states.get("cover.test").attributes
|
||||
assert ATTR_CURRENT_TILT_POSITION in state_attributes_dict
|
||||
@@ -864,6 +886,7 @@ async def test_tilt_via_invocation_defaults(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -943,6 +966,7 @@ async def test_tilt_given_value(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -1023,6 +1047,7 @@ async def test_tilt_given_value_optimistic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -1079,6 +1104,7 @@ async def test_tilt_given_value_altered_range(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -1145,6 +1171,7 @@ async def test_tilt_via_topic(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
async_fire_mqtt_message(hass, "tilt-status-topic", "0")
|
||||
|
||||
@@ -1184,6 +1211,7 @@ async def test_tilt_via_topic_template(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
async_fire_mqtt_message(hass, "tilt-status-topic", "99")
|
||||
|
||||
@@ -1222,6 +1250,7 @@ async def test_tilt_via_topic_altered_range(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
async_fire_mqtt_message(hass, "tilt-status-topic", "0")
|
||||
|
||||
@@ -1270,6 +1299,7 @@ async def test_tilt_via_topic_template_altered_range(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
async_fire_mqtt_message(hass, "tilt-status-topic", "99")
|
||||
|
||||
@@ -1313,6 +1343,7 @@ async def test_tilt_position(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -1348,6 +1379,7 @@ async def test_tilt_position_altered_range(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
@@ -1738,6 +1770,7 @@ async def test_valid_device_class(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.attributes.get("device_class") == "garage"
|
||||
@@ -1757,6 +1790,7 @@ async def test_invalid_device_class(hass, mqtt_mock):
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state is None
|
||||
|
||||
Reference in New Issue
Block a user