From e66ca5557903cd2544ea0e9920108da811caeee0 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Thu, 13 Apr 2017 20:42:14 +0300 Subject: [PATCH] Setup logging in unit tests We do not setup logging at the beginning of the unit test runs, which can cause oslo_log complaining about no handler for logging, depending on the import order: No handlers could be found for logger "ironic.drivers.modules.deploy_utils" This change adds logging in the unit tests __init__ module. Change-Id: I455c139a689aa8146ca1d985ef6900e73cef6558 --- ironic/tests/unit/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ironic/tests/unit/__init__.py b/ironic/tests/unit/__init__.py index d1cd870f2b..2abf56519a 100644 --- a/ironic/tests/unit/__init__.py +++ b/ironic/tests/unit/__init__.py @@ -25,11 +25,16 @@ # TODO(deva): move eventlet imports to ironic.__init__ once we move to PBR import eventlet +from oslo_config import cfg +from oslo_log import log from ironic import objects eventlet.monkey_patch(os=False) +log.register_options(cfg.CONF) +log.setup(cfg.CONF, 'ironic') + # NOTE(comstud): Make sure we have all of the objects loaded. We do this # at module import time, because we may be using mock decorators in our # tests that run at import time.