MCPcopy
hub / github.com/celery/celery / sanity_logging_side_effects

Function sanity_logging_side_effects

t/unit/conftest.py:249–265  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

247
248@pytest.fixture(autouse=True)
249def sanity_logging_side_effects(request):
250 from _pytest.logging import LogCaptureHandler
251 root = logging.getLogger()
252 rootlevel = root.level
253 roothandlers = [
254 x for x in root.handlers if not isinstance(x, LogCaptureHandler)]
255
256 yield
257
258 this = request.node.name
259 root_now = logging.getLogger()
260 if root_now.level != rootlevel:
261 raise RuntimeError(CASE_LOG_LEVEL_EFFECT.format(this))
262 newhandlers = [x for x in root_now.handlers if not isinstance(
263 x, LogCaptureHandler)]
264 if newhandlers != roothandlers:
265 raise RuntimeError(CASE_LOG_HANDLER_EFFECT.format(this))
266
267
268def setup_session(scope='session'):

Callers

nothing calls this directly

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…