Logging with unittest

Jared Windover jaredwindover at gmail.com
Thu Nov 27 22:37:49 CET 2014

I've been working with unittest for a while and just started using logging, and my question is: is it possible to use logging to display information about the tests you're running, but still have it be compatible with the --buffer option so that you only see it if a test fails? It seems like it would be a useful (and more standard than print statements) way to include stuff like parameter values near where a test may fail. 

What I currently have happening is that the logging output is shown regardless of whether or not the -b (or --buffer) flag is present. Any thoughts?

More information about the Python-list mailing list