Skip to content

Commit

Permalink
tests: disable DEBUG log level when pytest is launched with `--verb…
Browse files Browse the repository at this point in the history
…ose` (#149)
  • Loading branch information
palazzem authored Feb 20, 2024
1 parent 7cbfaf7 commit eaa145f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

import pytest
import responses
from elmo.api.client import ElmoClient
Expand All @@ -15,6 +17,18 @@
pytest_plugins = ["tests.hass.fixtures"]


def pytest_configure(config: pytest.Config) -> None:
"""Keeps the default log level to WARNING.
Home Assistant sets the log level to `DEBUG` if the `--verbose` flag is used.
Considering all the debug logs of this integration and `econnect-python`, this is very
noisy. This is an override for `tests/hass/fixtures.py` as described in this
issue: https://github.com/palazzem/ha-econnect-alarm/issues/134
"""
if config.getoption("verbose") > 0:
logging.getLogger().setLevel(logging.WARNING)


@pytest.fixture
async def hass(hass):
"""Create a Home Assistant instance for testing.
Expand Down

0 comments on commit eaa145f

Please sign in to comment.