I have an application where I introduced the standard logging library, I just set it up to WARNING.
When running unittesting I would like to avoid that those errors and warnings are appearing (just because I am making them intentionally!), but I would like to keep the verbose from unittesting.
Is there any way I can have the standard application with a logging level (WARNING) and during testing in a different one (none or CRITICAL?)
For example, I want my application in normal mode of operation to show the following:
=====
Application started
ERROR = input file is wrong
=====
However, when running my unittesting I do not want any of those outputs to appear, as I will actually make the app fail to check the correct error tracking, so it will be redundant to show the error messages and actually will complicate detecting the problems.
Looking to stackoverflow I found some similar problems, but not fixing my issue:
- The problem is with print, not with logging
Is there a way to suppress printing that is done within a unit test?
- Just eliminating part of test verbosity
Turn some print off in python unittest
Any idea/help?