mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Prevent tests changing units from affecting other tests (#70300)
* Prevent tests changing temperature_unit from affecting other tests * tweak
This commit is contained in:
@@ -4,6 +4,9 @@ from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def patch_zeroconf_multiple_catcher():
|
||||
@@ -33,3 +36,10 @@ def entity_registry_enabled_by_default() -> Generator[AsyncMock, None, None]:
|
||||
return_value=True,
|
||||
) as mock_entity_registry_enabled_by_default:
|
||||
yield mock_entity_registry_enabled_by_default
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def units_imperial(hass: HomeAssistant) -> Generator[None, None, None]:
|
||||
"""Fixture to temporary change units to imperial."""
|
||||
with patch.object(hass.config, "units", IMPERIAL_SYSTEM):
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user