Pytest Capture Not Working - Caplog And Capsys Are Empty
I am trying to create unit tests for a logger, but - even though the events are logged - the caplog and capsys remain empty. What am I doing wrong?
Solution 1:
It turned out that my logger had property propagate
set to False
. As a result, the events were not forwarded to LogCaptureHandler
added by pytest to the root logger.
Both caplog
and capsys
depend on LogCaptureHandler
receiving the propagated events.
Post a Comment for "Pytest Capture Not Working - Caplog And Capsys Are Empty"