vendredi 6 décembre 2019

How to suppress log messages in pytest tests?

I have a few python modules with functions which are tested using pytest. Some functions use logging, e.g.

logger = logging.getLogger(__name__)

def foo():
    ...
    logger.info('Something happened')
    ...

Now when I run the tests using pytest all the log messages are printed to stdout. How do I suppress them?

Aucun commentaire:

Enregistrer un commentaire