MCPcopy
hub / github.com/pallets/flask / reset_logging

Function reset_logging

tests/test_logging.py:13–33  ·  view source on GitHub ↗
(pytestconfig)

Source from the content-addressed store, hash-verified

11
12@pytest.fixture(autouse=True)
13def reset_logging(pytestconfig):
14 root_handlers = logging.root.handlers[:]
15 logging.root.handlers = []
16 root_level = logging.root.level
17
18 logger = logging.getLogger("flask_test")
19 logger.handlers = []
20 logger.setLevel(logging.NOTSET)
21
22 logging_plugin = pytestconfig.pluginmanager.unregister(name="logging-plugin")
23
24 yield
25
26 logging.root.handlers[:] = root_handlers
27 logging.root.setLevel(root_level)
28
29 logger.handlers = []
30 logger.setLevel(logging.NOTSET)
31
32 if logging_plugin:
33 pytestconfig.pluginmanager.register(logging_plugin, "logging-plugin")
34
35
36def test_logger(app):

Callers

nothing calls this directly

Calls 1

registerMethod · 0.45

Tested by

no test coverage detected