Skip to content

Commit

Permalink
Ensure consistent log levels in integration tests (equinor#6922)
Browse files Browse the repository at this point in the history
Some tests were moved from unit_tests to integration_tests in /a810eb0f8715e182d4e1b1dc1636356b97023711
that depend on log level details. This dependency was not triggered in Github actions workflows
but in komodo bleeding nightly tests.
  • Loading branch information
berland authored Jan 10, 2024
1 parent df1ca32 commit f27f7f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
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

0 comments on commit f27f7f8

Please sign in to comment.