How to use logging, pytest fixture and capsys?
问题 I am trying to unit-test some algorithm that uses logging library. I have a fixture that creates a logger. In my 1st test case , I do not use this fixture and uses a print to log to stdout. This test case passes . In my 2nd test case , I use this fixture, but not as documented in pytest doc. I just call the associated function in my test to get the logger. Then I use the logger to log to stdout. This test case passes . In my 3rd test case , I use this fixture as documented in pytest doc. The