diff --git a/requirements_test.txt b/requirements_test.txt index ba636c566490e4..8a18c5ac34e785 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -28,7 +28,7 @@ pytest-timeout==2.1.0 pytest-unordered==0.5.2 pytest-picked==0.4.6 pytest-xdist==3.3.1 -pytest==7.3.1 +pytest==7.4.1 requests_mock==1.11.0 respx==0.20.2 syrupy==4.2.1 diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py index e3a12a2c24ec80..7d5108f3fe38a1 100644 --- a/tests/components/mqtt/test_init.py +++ b/tests/components/mqtt/test_init.py @@ -3805,10 +3805,12 @@ def _check_entities() -> int: async_fire_mqtt_message(hass, "test-topic_manual1", "manual1_intial") async_fire_mqtt_message(hass, "test-topic_manual3", "manual3_intial") - assert (state := hass.states.get("sensor.test_manual1")) is not None + state = hass.states.get("sensor.test_manual1") + assert state is not None assert state.attributes["friendly_name"] == "test_manual1" assert state.state == "manual1_intial" - assert (state := hass.states.get("sensor.test_manual3")) is not None + state = hass.states.get("sensor.test_manual3") + assert state is not None assert state.attributes["friendly_name"] == "test_manual3" assert state.state == "manual3_intial" assert _check_entities() == 3 @@ -3839,16 +3841,20 @@ def _check_entities() -> int: assert entry.state is ConfigEntryState.LOADED await hass.async_block_till_done() - assert (state := hass.states.get("sensor.test_manual1")) is not None + state = hass.states.get("sensor.test_manual1") + assert state is not None assert state.attributes["friendly_name"] == "test_manual1_updated" assert state.state == STATE_UNKNOWN - assert (state := hass.states.get("sensor.test_manual2_new")) is not None + state = hass.states.get("sensor.test_manual2_new") + assert state is not None assert state.attributes["friendly_name"] == "test_manual2_new" assert state.state is STATE_UNKNOWN # State of test_manual3 is still loaded but is unavailable - assert (state := hass.states.get("sensor.test_manual3")) is not None + state = hass.states.get("sensor.test_manual3") + assert state is not None assert state.state is STATE_UNAVAILABLE - assert (state := hass.states.get("sensor.test_discovery")) is not None + state = hass.states.get("sensor.test_discovery") + assert state is not None assert state.state is STATE_UNAVAILABLE # The entity is not loaded anymore assert _check_entities() == 2 @@ -3857,11 +3863,14 @@ def _check_entities() -> int: async_fire_mqtt_message(hass, "test-topic_manual2", "manual2_update") async_fire_mqtt_message(hass, "test-topic_manual3", "manual3_update") - assert (state := hass.states.get("sensor.test_manual1")) is not None + state = hass.states.get("sensor.test_manual1") + assert state is not None assert state.state == "manual1_update" - assert (state := hass.states.get("sensor.test_manual2_new")) is not None + state = hass.states.get("sensor.test_manual2_new") + assert state is not None assert state.state == "manual2_update" - assert (state := hass.states.get("sensor.test_manual3")) is not None + state = hass.states.get("sensor.test_manual3") + assert state is not None assert state.state is STATE_UNAVAILABLE # Reload manual configured items and assert again @@ -3876,13 +3885,16 @@ def _check_entities() -> int: ) await hass.async_block_till_done() - assert (state := hass.states.get("sensor.test_manual1")) is not None + state = hass.states.get("sensor.test_manual1") + assert state is not None assert state.attributes["friendly_name"] == "test_manual1_updated" assert state.state == STATE_UNKNOWN - assert (state := hass.states.get("sensor.test_manual2_new")) is not None + state = hass.states.get("sensor.test_manual2_new") + assert state is not None assert state.attributes["friendly_name"] == "test_manual2_new" assert state.state == STATE_UNKNOWN - assert (state := hass.states.get("sensor.test_manual3")) is not None + state = hass.states.get("sensor.test_manual3") + assert state is not None assert state.state == STATE_UNAVAILABLE assert _check_entities() == 2 @@ -3892,9 +3904,12 @@ def _check_entities() -> int: async_fire_mqtt_message(hass, "test-topic_manual2", "manual2_update_after_reload") async_fire_mqtt_message(hass, "test-topic_manual3", "manual3_update_after_reload") - assert (state := hass.states.get("sensor.test_manual1")) is not None + state = hass.states.get("sensor.test_manual1") + assert state is not None assert state.state == "manual1_update_after_reload" - assert (state := hass.states.get("sensor.test_manual2_new")) is not None + state = hass.states.get("sensor.test_manual2_new") + assert state is not None assert state.state == "manual2_update_after_reload" - assert (state := hass.states.get("sensor.test_manual3")) is not None + state = hass.states.get("sensor.test_manual3") + assert state is not None assert state.state is STATE_UNAVAILABLE diff --git a/tests/helpers/test_entity_registry.py b/tests/helpers/test_entity_registry.py index f62addb9a64af1..ad3824374d32ff 100644 --- a/tests/helpers/test_entity_registry.py +++ b/tests/helpers/test_entity_registry.py @@ -1559,7 +1559,8 @@ def test_migrate_entity_to_new_platform( assert not entity_registry.async_get_entity_id("light", "hue", orig_unique_id) - assert (new_entry := entity_registry.async_get("light.light")) is not orig_entry + new_entry = entity_registry.async_get("light.light") + assert new_entry is not orig_entry assert new_entry.config_entry_id == new_config_entry.entry_id assert new_entry.unique_id == new_unique_id