mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Cache entity properties that are never expected to change in the base class (#95315)
This commit is contained in:
@@ -98,9 +98,13 @@ class TestHelpersEntity:
|
||||
|
||||
def setup_method(self, method):
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self._create_entity()
|
||||
|
||||
def _create_entity(self) -> None:
|
||||
self.entity = entity.Entity()
|
||||
self.entity.entity_id = "test.overwrite_hidden_true"
|
||||
self.hass = self.entity.hass = get_test_home_assistant()
|
||||
self.entity.hass = self.hass
|
||||
self.entity.schedule_update_ha_state()
|
||||
self.hass.block_till_done()
|
||||
|
||||
@@ -123,6 +127,7 @@ class TestHelpersEntity:
|
||||
with patch(
|
||||
"homeassistant.helpers.entity.Entity.device_class", new="test_class"
|
||||
):
|
||||
self._create_entity()
|
||||
self.entity.schedule_update_ha_state()
|
||||
self.hass.block_till_done()
|
||||
state = self.hass.states.get(self.entity.entity_id)
|
||||
|
||||
Reference in New Issue
Block a user