MCPcopy
hub / github.com/Delgan/loguru / test_caught_exception_queue_get

Function test_caught_exception_queue_get

tests/test_add_option_enqueue.py:108–123  ·  view source on GitHub ↗
(writer, capsys)

Source from the content-addressed store, hash-verified

106
107
108def test_caught_exception_queue_get(writer, capsys):
109 logger.add(writer, enqueue=True, catch=True, format="{message}")
110
111 logger.info("It's fine")
112 logger.bind(broken=NotUnpicklable()).info("Bye bye...")
113 logger.info("It's fine again")
114 logger.remove()
115
116 out, err = capsys.readouterr()
117 lines = err.strip().splitlines()
118 assert writer.read() == "It's fine\nIt's fine again\n"
119 assert out == ""
120 assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
121 assert lines[1] == "Record was: None"
122 assert "UnpicklingError: You shall not de-serialize me!" in err
123 assert lines[-1] == "--- End of logging error ---"
124
125
126def test_caught_exception_sink_write(capsys):

Callers

nothing calls this directly

Calls 7

NotUnpicklableClass · 0.85
addMethod · 0.80
infoMethod · 0.80
bindMethod · 0.80
removeMethod · 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…