Solve racing problem in modbus test (#100287)

* Test racing problem.

* review comment.

* Revert to approved state.

This reverts commit 983d9d68e8f77bae33ef4f8f1ac8c31cddfa6dca.
This commit is contained in:
jan iversen 2023-09-14 16:03:32 +02:00 committed by GitHub
parent 7ea2087c45
commit d4a2927ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -884,7 +884,7 @@ async def test_stop_restart(
caplog.set_level(logging.INFO)
entity_id = f"{SENSOR_DOMAIN}.{TEST_ENTITY_NAME}".replace(" ", "_")
assert hass.states.get(entity_id).state == STATE_UNKNOWN
assert hass.states.get(entity_id).state in (STATE_UNKNOWN, STATE_UNAVAILABLE)
hass.states.async_set(entity_id, 17)
await hass.async_block_till_done()
assert hass.states.get(entity_id).state == "17"