MCPcopy Create free account
hub / github.com/Delgan/loguru / test_exception

Function test_exception

tests/test_interception.py:99–111  ·  view source on GitHub ↗
(writer)

Source from the content-addressed store, hash-verified

97
98
99def test_exception(writer):
100 with make_logging_logger("tests.test_interception", InterceptHandler()) as logging_logger:
101 logger.add(writer, format="{message}")
102
103 try:
104 1 / 0 # noqa: B018
105 except Exception:
106 logging_logger.exception("Oops...")
107
108 lines = writer.read().strip().splitlines()
109 assert lines[0] == "Oops..."
110 assert lines[-1] == "ZeroDivisionError: division by zero"
111 assert sum(line.startswith("> ") for line in lines) == 1
112
113
114def test_level_is_no(writer):

Callers

nothing calls this directly

Calls 6

make_logging_loggerFunction · 0.85
InterceptHandlerClass · 0.85
addMethod · 0.80
exceptionMethod · 0.80
readMethod · 0.80
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…