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:
parent
f78199df9f
commit
915f5bf84e
1 changed files with 7 additions and 3 deletions
|
@ -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)
|
@pytest.fixture(autouse=True)
|
||||||
def bcrypt_cost() -> Generator[None, None, None]:
|
def bcrypt_cost() -> Generator[None, None, None]:
|
||||||
"""Run with reduced rounds during tests, to speed up uses."""
|
"""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
|
# Restore timezone, it is set when creating the hass object
|
||||||
dt_util.DEFAULT_TIME_ZONE = orig_tz
|
dt_util.DEFAULT_TIME_ZONE = orig_tz
|
||||||
|
|
||||||
# Reset the _Hass threading.local object
|
|
||||||
ha._hass.__dict__.clear()
|
|
||||||
|
|
||||||
for ex in exceptions:
|
for ex in exceptions:
|
||||||
if (
|
if (
|
||||||
request.module.__name__,
|
request.module.__name__,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue