I'm considering some ways to unit test logging code in a Python application. I see the following alternatives:
- Mock
logging.getLoggerand track calls to the methods of the mock. - Configure a specific logging handler and use it to capture log messages.
I wonder what are the pros and cons of the two and if there're other alternatives. My tests are based on unittest & nose.
Aucun commentaire:
Enregistrer un commentaire