title: How should I verify a log message when testing Python code under nose?
body: <p>I'm trying to write a simple unit test that will verify that, under a certain condition, a class in my application will log an error via the standard logging API.  I can't work out what the cleanest way to test this situation is.</p>
  
  <p>I know that nose already captures logging output through it's logging plugin, but this seems to be intended as a reporting and debugging aid for failed tests.  </p>
  
  <p>The two ways to do this I can see are:</p>
  
  <ul>
  <li>Mock out the logging module, either in a piecemeal way (mymodule.logging = mockloggingmodule) or with a proper mocking library.</li>
  <li>Write or use an existing nose plugin to capture the output and verify it.</li>
  </ul>
  
  <p>If I go for the former approach, I'd like to know what the cleanest way to reset the global state to what it was before I mocked out the logging module.</p>
  
  <p>Looking forward to your hints and tips on this one...</p>