So I have a lot of (pytest) test that test logs with the caplog fixture, probably not done in the best way (as I'm realizing now). I used a ot of statements like caplog.records[0]
and caplog.records[-1]
but now I need to log something in a function that is called a lot through out my project and this messes up all my test where I currently didn't expect to have additional logs. Is there any way how I can tell caplog that it should not record this new specific log, without having to rewrite all usages of caplog?
I was thinking of something like writing a wrapper around the caplog fixture ...?
I found a quite simple solution to this: I can just disable certain loggers by name with a simple fixture like this: