import logging import pytest import unittest.mock from cipy import _handler @pytest.fixture(scope="function") def ci_logger(monkeypatch: pytest.MonkeyPatch) -> unittest.mock.Mock: mock = unittest.mock.Mock(spec=logging.Formatter) monkeypatch.setattr(_handler, "formatter", mock) level = logging.getLogger().level logging.getLogger().setLevel(logging.NOTSET) yield mock logging.getLogger().setLevel(level)