Improve ability to debug one time listeners blocking the event loop (#110064)

This commit is contained in:
J. Nick Koston 2024-02-09 01:44:14 -06:00 committed by GitHub
parent 720fb7da59
commit b5afdf34f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View file

@ -2818,3 +2818,16 @@ def test_deprecated_constants(
) -> None:
"""Test deprecated constants."""
import_and_test_deprecated_constant_enum(caplog, ha, enum, "SOURCE_", "2025.1")
def test_one_time_listener_repr(hass: HomeAssistant) -> None:
"""Test one time listener repr."""
def _listener(event: ha.Event):
"""Test listener."""
one_time_listener = ha._OneTimeListener(hass, _listener)
repr_str = repr(one_time_listener)
assert "OneTimeListener" in repr_str
assert "test_core" in repr_str
assert "_listener" in repr_str