forked from orbit-oss/flask
use config fixture, get plugin via unregister
This commit is contained in:
parent
33fa580947
commit
604cc758fb
1 changed files with 5 additions and 5 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue