[Python-checkins] cpython: Document autoflushing in packaging.test.support.LoggingCatcher.get_logs.

eric.araujo python-checkins at python.org
Fri Jun 3 17:28:49 CEST 2011


http://hg.python.org/cpython/rev/7608156284b4
changeset:   70615:7608156284b4
user:        Éric Araujo <merwok at netwok.org>
date:        Fri Jun 03 17:28:23 2011 +0200
summary:
  Document autoflushing in packaging.test.support.LoggingCatcher.get_logs.

I’m afraid my docstring is not as clear as it should be, but I can’t
find a concise way of describing what the code does.  Suggestions for
improvements welcome.

files:
  Lib/packaging/tests/support.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py
--- a/Lib/packaging/tests/support.py
+++ b/Lib/packaging/tests/support.py
@@ -65,7 +65,10 @@
     configured to record all messages logged to the 'packaging' logger.
 
     Use get_logs to retrieve messages and self.loghandler.flush to discard
-    them.
+    them.  get_logs automatically flushes the logs; if you test code that
+    generates logging messages but don't use get_logs, you have to flush
+    manually before doing other checks on logging message, otherwise you
+    will get irrelevant results.  See example in test_command_check.
     """
 
     def setUp(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list