changeset 4732:0f96804480c3

tests: create default logging handler to mute 'No handlers could be found for logger' warnings
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Jan 2015 00:54:36 +0100
parents c154dc461bd5
children 7a9a231d365d
files kallithea/tests/__init__.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/__init__.py	Tue Jan 06 00:54:36 2015 +0100
+++ b/kallithea/tests/__init__.py	Tue Jan 06 00:54:36 2015 +0100
@@ -157,6 +157,12 @@
     return get_normalized_path(path)
 
 
+import logging
+
+class NullHandler(logging.Handler):
+    def emit(self, record):
+        pass
+
 def init_stack(config=None):
     if not config:
         config = pylons.test.pylonsapp.config
@@ -167,6 +173,8 @@
     # Initialize a translator for tests that utilize i18n
     translator = _get_translator(pylons.config.get('lang'))
     pylons.translator._push_object(translator)
+    h = NullHandler()
+    logging.getLogger("kallithea").addHandler(h)
 
 
 class BaseTestCase(unittest.TestCase):