[Python-Dev] Using logging in the stdlib and its unit tests

Chris Withers chris at simplistix.co.uk
Tue Dec 14 00:41:28 CET 2010


On 07/12/2010 20:26, Vinay Sajip wrote:
> I would suggest that when unit testing, rather than adding StreamHandlers to log
> to stderr, that something like TestHandler and Matcher from this post:
>
> http://plumberjack.blogspot.com/2010/09/unit-testing-and-logging.html

For Python 2, my testfixtures package has had some helpful bits in this 
area for a while now:

http://packages.python.org/testfixtures/logging.html

I find it important to be able to check my code is logging what I think 
it should be logging!

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk


More information about the Python-Dev mailing list