Browse Source

Merge pull request #2554 from camilojimenez/2550-some-tests-fail

fix non-passing tests for logging on pytest >= 3.3.0
pull/2556/head
David Lord 7 years ago committed by GitHub
parent
commit
27a7171d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      tests/test_logging.py

9
tests/test_logging.py

@ -9,14 +9,18 @@ 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 = pytestconfig.pluginmanager.unregister(
name='logging-plugin')
yield
logging.root.handlers[:] = root_handlers
@ -25,6 +29,9 @@ def reset_logging(monkeypatch):
logger.handlers = []
logger.setLevel(logging.NOTSET)
if logging_plugin:
pytestconfig.pluginmanager.register(logging_plugin, 'logging-plugin')
def test_logger(app):
assert app.logger.name == 'flask.app'

Loading…
Cancel
Save