[Zope3-dev] Win32 Tests - Zope 3 - Not OK :-(

Guido van Rossum guido@python.org
Mon, 10 Mar 2003 11:37:08 -0500


> These tests aren't failing, but they are causing critical-level logging
> messages to be generated.  I don't know how to disable the logging
> during testing.  I think, ideally, we could add an assertion to the unit
> test that a log message is generated.  The test in question provokes a
> failure during the second phase of two-phase commit to test the error
> handling in that case -- part of the error handling is to log a message.

To disable all logging for a particular test, I think you can do the
following (untested for details):

  in setUp():
    self.save_level = logging.root.level
    logging.root.setLevel(sys.maxint) # Or maybe logging.CRITICAL+1

  in tearDown():
    logging.root.setLevel(self.save_level)

--Guido van Rossum (home page: http://www.python.org/~guido/)