You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an issue with capturing stdout/stderr when using structlog with stdlib Logger in tests.
I've raised an issue with structlog but they are not convinced the problem originates there since the logs are simply passed to the stdlib Logger.
I've traced this down to the click's isolation context manager which seems to replace sys.stdout/sys.stderr with mocks during testing and my guess would be that this could have something to do with the problem but I'm hoping you may know better.
I've tried numerous things like explicitly setting a StreamHandler(sys.stderr) to the stdlib basicConfig, experimented with mix_stderr etc. nothing helped. Any ideas how to fix or work around this issue would be most welcome, thank you.
There seems to be an issue with capturing stdout/stderr when using
structlog
with stdlibLogger
in tests.I've raised an issue with
structlog
but they are not convinced the problem originates there since the logs are simply passed to the stdlib Logger.I've traced this down to the click's
isolation
context manager which seems to replacesys.stdout
/sys.stderr
with mocks during testing and my guess would be that this could have something to do with the problem but I'm hoping you may know better.I've tried numerous things like explicitly setting a
StreamHandler(sys.stderr)
to the stdlibbasicConfig
, experimented withmix_stderr
etc. nothing helped. Any ideas how to fix or work around this issue would be most welcome, thank you.An example
A test case:
Expected
Hello! (to be printed)
assertion to pass
Actual
nothing printed (result.stdout is empty)
assertion failure:
The text was updated successfully, but these errors were encountered: