Reset log level in script tests (#109881)
This commit is contained in:
parent
b5b09446a1
commit
de066c7fc0
2 changed files with 20 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
"""Test the auth script to manage local users."""
|
"""Test the auth script to manage local users."""
|
||||||
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
@ -11,6 +12,15 @@ from homeassistant.scripts import auth as script_auth
|
||||||
from tests.common import register_auth_provider
|
from tests.common import register_auth_provider
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def reset_log_level():
|
||||||
|
"""Reset log level after each test case."""
|
||||||
|
logger = logging.getLogger("homeassistant.core")
|
||||||
|
orig_level = logger.level
|
||||||
|
yield
|
||||||
|
logger.setLevel(orig_level)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def provider(hass):
|
def provider(hass):
|
||||||
"""Home Assistant auth provider."""
|
"""Home Assistant auth provider."""
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Test check_config script."""
|
"""Test check_config script."""
|
||||||
|
import logging
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -22,6 +23,15 @@ BASE_CONFIG = (
|
||||||
BAD_CORE_CONFIG = "homeassistant:\n unit_system: bad\n\n\n"
|
BAD_CORE_CONFIG = "homeassistant:\n unit_system: bad\n\n\n"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def reset_log_level():
|
||||||
|
"""Reset log level after each test case."""
|
||||||
|
logger = logging.getLogger("homeassistant.loader")
|
||||||
|
orig_level = logger.level
|
||||||
|
yield
|
||||||
|
logger.setLevel(orig_level)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def apply_stop_hass(stop_hass: None) -> None:
|
async def apply_stop_hass(stop_hass: None) -> None:
|
||||||
"""Make sure all hass are stopped."""
|
"""Make sure all hass are stopped."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue