diff options
author | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-07-04 15:04:29 +0200 |
---|---|---|
committer | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-07-04 15:25:41 +0200 |
commit | 4d9328c4de548476568e995c854cf75aac268fdf (patch) | |
tree | 06a1a6357160faf3b3298e2c8a9a058f08f650c8 | |
parent | 6e450ad8a3e0ec97750e48f4c337c843eed7b336 (diff) | |
download | oslo-incubator-4d9328c4de548476568e995c854cf75aac268fdf.tar.gz |
Python 3: enable tests/unit/test_log.py
Change-Id: I2ae861b73cf32c4f732a31ae93f7a86b05890fbb
-rw-r--r-- | openstack/common/log.py | 7 | ||||
-rw-r--r-- | tests/unit/test_log.py | 2 | ||||
-rw-r--r-- | tox.ini | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/openstack/common/log.py b/openstack/common/log.py index 9c0d1937..4f2c86c8 100644 --- a/openstack/common/log.py +++ b/openstack/common/log.py @@ -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)) diff --git a/tests/unit/test_log.py b/tests/unit/test_log.py index 5651aa58..d63a6b16 100644 --- a/tests/unit/test_log.py +++ b/tests/unit/test_log.py @@ -630,7 +630,7 @@ class LogConfigOptsTestCase(test_base.BaseTestCase): class LogConfigTestCase(test_base.BaseTestCase): - minimal_config = """[loggers] + minimal_config = b"""[loggers] keys=root [formatters] @@ -103,6 +103,7 @@ commands = tests.unit.test_importutils \ tests.unit.test_jsonutils \ tests.unit.test_local \ + tests.unit.test_log \ tests.unit.test_memorycache \ tests.unit.test_network_utils \ tests.unit.test_notifier \ |