From b49d6a299ba437d30ba283ba6afabe6d2ece26d3 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 11 Apr 2014 17:37:42 +0900 Subject: [PATCH] Make logger available during tests If any tests exercise code paths that emit logs, a warning is displayed: No handlers could be found for logger "jenkins_jobs.modules.NAME" Set up a logger with default configuration in the base test class. Now any logs will be displayed on the console. Change-Id: Ib36afd5d96ff8e7fed110b6bedb6e281aac584f8 --- tests/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/base.py b/tests/base.py index c58c48976..3a66e5726 100644 --- a/tests/base.py +++ b/tests/base.py @@ -18,6 +18,7 @@ # under the License. import codecs +import logging import os import re import doctest @@ -63,6 +64,8 @@ class BaseTestCase(object): maxDiff = None # always dump text difference longMessage = True # keep normal error message when providing our + logging.basicConfig() + def __read_content(self): # Read XML content, assuming it is unicode encoded xml_filepath = os.path.join(self.fixtures_path, self.xml_filename)