|
|
|
@ -9,17 +9,17 @@ from flask.logging import default_handler, has_level_handler, \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True) |
|
|
|
|
def reset_logging(monkeypatch): |
|
|
|
|
def reset_logging(pytestconfig): |
|
|
|
|
root_handlers = logging.root.handlers[:] |
|
|
|
|
logging.root.handlers = [] |
|
|
|
|
root_level = logging.root.level |
|
|
|
|
|
|
|
|
|
logger = logging.getLogger('flask.app') |
|
|
|
|
logger.handlers = [] |
|
|
|
|
logger.setLevel(logging.NOTSET) |
|
|
|
|
|
|
|
|
|
logging_plugin = pytest.config.pluginmanager.getplugin('logging-plugin') |
|
|
|
|
pytest.config.pluginmanager.unregister(name='logging-plugin') |
|
|
|
|
logging.root.handlers = [] |
|
|
|
|
logging_plugin = pytestconfig.pluginmanager.unregister( |
|
|
|
|
name='logging-plugin') |
|
|
|
|
|
|
|
|
|
yield |
|
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ def reset_logging(monkeypatch):
|
|
|
|
|
logger.setLevel(logging.NOTSET) |
|
|
|
|
|
|
|
|
|
if logging_plugin: |
|
|
|
|
pytest.config.pluginmanager.register(logging_plugin, 'logging-plugin') |
|
|
|
|
pytestconfig.pluginmanager.register(logging_plugin, 'logging-plugin') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_logger(app): |
|
|
|
|