mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Add back logging for core for feature flags in climate (#109572)
This commit is contained in:
parent
a74516a80d
commit
e877113b21
@ -339,9 +339,6 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
|
|
||||||
def _report_turn_on_off(feature: str, method: str) -> None:
|
def _report_turn_on_off(feature: str, method: str) -> None:
|
||||||
"""Log warning not implemented turn on/off feature."""
|
"""Log warning not implemented turn on/off feature."""
|
||||||
module = type(self).__module__
|
|
||||||
if module and "custom_components" not in module:
|
|
||||||
return
|
|
||||||
report_issue = self._suggest_report_issue()
|
report_issue = self._suggest_report_issue()
|
||||||
if feature.startswith("TURN"):
|
if feature.startswith("TURN"):
|
||||||
message = (
|
message = (
|
||||||
|
@ -684,65 +684,3 @@ async def test_no_warning_integration_has_migrated(
|
|||||||
" implements HVACMode(s): off, heat and therefore implicitly supports the off, heat methods"
|
" implements HVACMode(s): off, heat and therefore implicitly supports the off, heat methods"
|
||||||
not in caplog.text
|
not in caplog.text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_no_warning_on_core_integrations_for_on_off_feature_flags(
|
|
||||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, config_flow_fixture: None
|
|
||||||
) -> None:
|
|
||||||
"""Test we don't warn on core integration on new turn_on/off feature flags."""
|
|
||||||
|
|
||||||
class MockClimateEntityTest(MockClimateEntity):
|
|
||||||
"""Mock Climate device."""
|
|
||||||
|
|
||||||
def turn_on(self) -> None:
|
|
||||||
"""Turn on."""
|
|
||||||
|
|
||||||
def turn_off(self) -> None:
|
|
||||||
"""Turn off."""
|
|
||||||
|
|
||||||
async def async_setup_entry_init(
|
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry
|
|
||||||
) -> bool:
|
|
||||||
"""Set up test config entry."""
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, [DOMAIN])
|
|
||||||
return True
|
|
||||||
|
|
||||||
async def async_setup_entry_climate_platform(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
config_entry: ConfigEntry,
|
|
||||||
async_add_entities: AddEntitiesCallback,
|
|
||||||
) -> None:
|
|
||||||
"""Set up test climate platform via config entry."""
|
|
||||||
async_add_entities(
|
|
||||||
[MockClimateEntityTest(name="test", entity_id="climate.test")]
|
|
||||||
)
|
|
||||||
|
|
||||||
mock_integration(
|
|
||||||
hass,
|
|
||||||
MockModule(
|
|
||||||
"test",
|
|
||||||
async_setup_entry=async_setup_entry_init,
|
|
||||||
),
|
|
||||||
built_in=False,
|
|
||||||
)
|
|
||||||
mock_platform(
|
|
||||||
hass,
|
|
||||||
"test.climate",
|
|
||||||
MockPlatform(async_setup_entry=async_setup_entry_climate_platform),
|
|
||||||
)
|
|
||||||
|
|
||||||
with patch.object(
|
|
||||||
MockClimateEntityTest, "__module__", "homeassistant.components.test.climate"
|
|
||||||
):
|
|
||||||
config_entry = MockConfigEntry(domain="test")
|
|
||||||
config_entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
state = hass.states.get("climate.test")
|
|
||||||
assert state is not None
|
|
||||||
|
|
||||||
assert (
|
|
||||||
"does not set ClimateEntityFeature.TURN_OFF but implements the turn_off method."
|
|
||||||
not in caplog.text
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user