On 28/11/2011 04:16, cassiope wrote:
I've been trying to migrate some code to using the standard python
logging classes/objects.  And they seem quite capable of doing what I
need them to do.  Unfortunately there's a problem in my unit tests.
It's fairly common to have to create quite a few entities in the
course of a series of tests.  What appears to be happening is that the
loggers don't get entirely eliminated, so that new invocations end up
spewing output messages from each of the loggers that were started
with this invocation of the python interpreter.

Two suggestions:

- unless you are specifically testing the logging set up of your application, your code under test shouldn't be setting up logging.

- if you want to check that your code under test is emitting log messages correctly, use a LogCapture from testfixtures:

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

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to