Python 3: enable tests/unit/test_log.py

Change-Id: I2ae861b73cf32c4f732a31ae93f7a86b05890fbb
This commit is contained in:
Cyril Roelandt
2014-07-04 15:04:29 +02:00
parent 7ad19349e4
commit 9382cf6174
2 changed files with 7 additions and 2 deletions

View File

@@ -244,6 +244,11 @@ class LazyAdapter(BaseLoggerAdapter):
def logger(self):
if not self._logger:
self._logger = getLogger(self.name, self.version)
if six.PY3:
# In Python 3, the code fails because the 'manager' attribute
# cannot be found when using a LoggerAdapter as the
# underlying logger. Work around this issue.
self._logger.manager = self._logger.logger.manager
return self._logger
@@ -397,7 +402,7 @@ def _load_log_config(log_config_append):
try:
logging.config.fileConfig(log_config_append,
disable_existing_loggers=False)
except moves.configparser.Error as exc:
except (moves.configparser.Error, KeyError) as exc:
raise LogConfigError(log_config_append, six.text_type(exc))

View File

@@ -630,7 +630,7 @@ class LogConfigOptsTestCase(test_base.BaseTestCase):
class LogConfigTestCase(test_base.BaseTestCase):
minimal_config = """[loggers]
minimal_config = b"""[loggers]
keys=root
[formatters]