Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: disable DEBUG log level when pytest is launched with --verbose #149

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading