Open Nelly-Barret opened 3 weeks ago
I could kind of do it by removing the FileHandler in the logging (thus, only the StreamHandler remains) but then, Python complains about an unclosed file because the logging is initialized before the test starts so the logging file is).
Taking a look at: https://docs.python.org/3/library/logging.html#logging.basicConfig, I do not see how to say "when to print log" in the BasicConfig
constructor.
To be seen
Easy solution: use print
instead of log.info
!
This still creates the log file... because tested classes still print using log.info
and log.debug
Check this: https://betterstack.com/community/questions/how-to-disable-logging-when-running-tests-in-python/
As of know, whenever I run the code (src or tests), a log file is generated and put next to the "temporary" files.
This is annoying for tests and a bit useless, so I should create those log files only when running src.