1
mirror of https://github.com/home-assistant/core synced 2024-07-21 14:24:50 +02:00

Reset the threading.local _hass object every time (#101728)

* Reset the threading.local _hass object every time

* Remove reset from hass fixture
This commit is contained in:
Marc Mueller 2023-10-10 12:43:12 +02:00 committed by GitHub
parent f78199df9f
commit 915f5bf84e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -376,6 +376,13 @@ def verify_cleanup(
)
@pytest.fixture(autouse=True)
def reset_hass_threading_local_object() -> Generator[None, None, None]:
"""Reset the _Hass threading.local object for every test case."""
yield
ha._hass.__dict__.clear()
@pytest.fixture(autouse=True)
def bcrypt_cost() -> Generator[None, None, None]:
"""Run with reduced rounds during tests, to speed up uses."""
@ -559,9 +566,6 @@ async def hass(
# Restore timezone, it is set when creating the hass object
dt_util.DEFAULT_TIME_ZONE = orig_tz
# Reset the _Hass threading.local object
ha._hass.__dict__.clear()
for ex in exceptions:
if (
request.module.__name__,