← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stub/launchpad/trivial into lp:launchpad

 

Stuart Bishop has proposed merging lp:~stub/launchpad/trivial into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #660770 root logger in tests is very noisy
  https://bugs.launchpad.net/bugs/660770


Stop test output spam from the logging system.

We were resetting everything too aggressively between tests, undoing changes made in lp_sitecustomize.
-- 
https://code.launchpad.net/~stub/launchpad/trivial/+merge/44047
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/trivial into lp:launchpad.
=== modified file 'lib/canonical/testing/__init__.py'
--- lib/canonical/testing/__init__.py	2010-10-19 01:42:48 +0000
+++ lib/canonical/testing/__init__.py	2010-12-17 13:37:18 +0000
@@ -27,11 +27,14 @@
 
 import logging
 
+import lp_sitecustomize
+
 
 def reset_logging():
     """Reset the logging system back to defaults
 
     Currently, defaults means 'the way the Z3 testrunner sets it up'
+    plus customizations made in lp_sitecustomize
     """
     # Remove all handlers from non-root loggers, and remove the loggers too.
     loggerDict = logging.Logger.manager.loggerDict
@@ -62,7 +65,7 @@
     from zope.testing.testrunner.runner import Runner
     from zope.testing.testrunner.logsupport import Logging
     Logging(Runner()).global_setup()
-
+    lp_sitecustomize.customize_logger()
 
 
 # This import registers the 'doctest' Unicode codec.

=== modified file 'lib/lp_sitecustomize.py'
--- lib/lp_sitecustomize.py	2010-11-12 13:28:34 +0000
+++ lib/lp_sitecustomize.py	2010-12-17 13:37:18 +0000
@@ -92,6 +92,17 @@
         module="Crypto")
 
 
+def customize_logger():
+    """Customize the logging system.
+
+    This function is also invoked by the test infrastructure to reset
+    logging between tests.
+    """
+    silence_bzr_logger()
+    silence_zcml_logger()
+    silence_transaction_logger()
+
+
 def main(instance_name):
     # This is called by our custom buildout-generated sitecustomize.py
     # in parts/scripts/sitecustomize.py. The instance name is sent to
@@ -115,6 +126,4 @@
     grouper = type(list(itertools.groupby([0]))[0][1])
     checker.BasicTypes[grouper] = checker._iteratorChecker
     silence_warnings()
-    silence_bzr_logger()
-    silence_zcml_logger()
-    silence_transaction_logger()
+    customize_logger()