Skip to content

Commit

Permalink
Reset log level in script tests (home-assistant#109881)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Feb 7, 2024
1 parent b5b0944 commit de066c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/scripts/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the auth script to manage local users."""
import logging
from typing import Any
from unittest.mock import Mock, patch

Expand All @@ -11,6 +12,15 @@
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
def provider(hass):
"""Home Assistant auth provider."""
Expand Down
10 changes: 10 additions & 0 deletions tests/scripts/test_check_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test check_config script."""
import logging
from unittest.mock import patch

import pytest
Expand All @@ -22,6 +23,15 @@
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)
async def apply_stop_hass(stop_hass: None) -> None:
"""Make sure all hass are stopped."""
Expand Down

0 comments on commit de066c7

Please sign in to comment.