Browse Source

use config fixture, get plugin via unregister

pull/2554/head
David Lord 7 years ago
parent
commit
604cc758fb
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 10
      tests/test_logging.py

10
tests/test_logging.py

@ -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):

Loading…
Cancel
Save