Changeset - 0f96804480c3
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-01-06 00:54:36
madski@unity3d.com
tests: create default logging handler to mute 'No handlers could be found for logger' warnings
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/__init__.py
Show inline comments
 
@@ -157,6 +157,12 @@ def get_new_dir(title):
 
    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 @@ def init_stack(config=None):
 
    # 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):
0 comments (0 inline, 0 general)