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

Function test_caught_exception_queue_put

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

Source from the content-addressed store, hash-verified

88
89
90def test_caught_exception_queue_put(writer, capsys):
91 logger.add(writer, enqueue=True, catch=True, format="{message}")
92
93 logger.info("It's fine")
94 logger.bind(broken=NotPicklable()).info("Bye bye...")
95 logger.info("It's fine again")
96 logger.remove()
97
98 out, err = capsys.readouterr()
99 lines = err.strip().splitlines()
100 assert writer.read() == "It's fine\nIt's fine again\n"
101 assert out == ""
102 assert lines[0] == "--- Logging error in Loguru Handler #0 ---"
103 assert re.match(r"Record was: \{.*Bye bye.*\}", lines[1])
104 assert "PicklingError: You shall not serialize me!" in err
105 assert lines[-1] == "--- End of logging error ---"
106
107
108def test_caught_exception_queue_get(writer, capsys):

Callers

nothing calls this directly

Calls 7

NotPicklableClass · 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…