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

Ensure consistent log levels in integration tests #6922

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import fileinput
import logging
import os
import pkgutil
import resource
Expand Down Expand Up @@ -30,6 +31,18 @@
from importlib.abc import FileLoader


@pytest.fixture(autouse=True)
def log_check():
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
yield
logger_after = logging.getLogger()
level_after = logger_after.getEffectiveLevel()
assert (
level_after == logging.WARNING
), f"Detected differences in log environment: Changed to {level_after}"


@pytest.fixture
def _qt_add_search_paths(qapp):
"Ensure that icons and such are found by the tests"
Expand Down
13 changes: 0 additions & 13 deletions tests/unit_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import os
import sys

Expand All @@ -7,18 +6,6 @@
from ert.ensemble_evaluator.config import EvaluatorServerConfig


@pytest.fixture(autouse=True)
def log_check():
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
yield
logger_after = logging.getLogger()
level_after = logger_after.getEffectiveLevel()
assert (
level_after == logging.WARNING
), f"Detected differences in log environment: Changed to {level_after}"


@pytest.fixture(autouse=True)
def no_cert_in_test(monkeypatch):
# Do not generate certificates during test, parts of it can be time
Expand Down
Loading