Make helpers.frame.report_usage work when called from any thread (#139836)

* Make helpers.frame.report_usage work when called from any thread

* Address review comments, update tests

* Add test

* Update test

* Update recorder test

* Update tests
This commit is contained in:
Erik Montnemery
2025-03-05 19:37:34 +01:00
committed by GitHub
parent cfaf18f942
commit cc5c8bf5e3
12 changed files with 113 additions and 18 deletions

View File

@@ -84,6 +84,7 @@ from homeassistant.helpers import (
device_registry as dr,
entity_registry as er,
floor_registry as fr,
frame,
issue_registry as ir,
label_registry as lr,
recorder as recorder_helper,
@@ -433,6 +434,7 @@ def reset_hass_threading_local_object() -> Generator[None]:
"""Reset the _Hass threading.local object for every test case."""
yield
ha._hass.__dict__.clear()
frame.async_setup(None)
@pytest.fixture(autouse=True, scope="session")
@@ -599,6 +601,7 @@ async def hass(
async with async_test_home_assistant(loop, load_registries) as hass:
orig_exception_handler = loop.get_exception_handler()
loop.set_exception_handler(exc_handle)
frame.async_setup(hass)
yield hass