Registering a root logger during a test leads to empty caplog #11618
Unanswered
a-recknagel
asked this question in
Q&A
Replies: 2 comments
-
Hello, @a-recknagel So my suggestions would be these:
To do so you might need to
And then use import os
from functools import cache
@cache
def setup_logging():
if os.getenv('UNIT_TESTS'):
return
... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Caplog has tools for per tests level choices Alternatively actually clean up after yourself |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This issue was already discovered in #11011, but their solution of "just don't configure a root logger in your test" doesn't work for me.
Repro:
Is there a way to re-run the logic caplog uses to hook onto the root logger? At least, that's what I assume is going wrong here, I didn't actually dig into the code.
Beta Was this translation helpful? Give feedback.
All reactions