Reset helpers.frame._REPORTED_INTEGRATIONS in between tests (#139924)

* Reset helpers.frame._REPORTED_INTEGRATIONS in between tests

* Rename

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
epenet
2025-03-06 13:57:13 +01:00
committed by GitHub
parent 1a4a3a0f08
commit 377e0a64d1
11 changed files with 9 additions and 30 deletions

View File

@@ -430,11 +430,16 @@ def verify_cleanup(
@pytest.fixture(autouse=True)
def reset_hass_threading_local_object() -> Generator[None]:
"""Reset the _Hass threading.local object for every test case."""
def reset_globals() -> Generator[None]:
"""Reset global objects for every test case."""
yield
# Reset the _Hass threading.local object
ha._hass.__dict__.clear()
# Reset the frame helper globals
frame.async_setup(None)
frame._REPORTED_INTEGRATIONS.clear()
@pytest.fixture(autouse=True, scope="session")