Nosetests: Capturing log messages written to stderr

This is a tip for using the Python logging module in conjunction with unit-tests. When using the root logger to write debug messages, e.g.  import logging .. logging.debug(‘x = %s’ % x) to capture the messages and write them to the console when running nosetests, pass ‘root’ to the –log-debug nosetests option. E.g. nosetests test_module1.py …

Nosetests: Capturing log messages written to stderr Read More »