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
This commit is contained in:
Vladyslav Drok 2017-04-13 20:42:14 +03:00
parent 20815f5d87
commit e66ca55579
1 changed files with 5 additions and 0 deletions

View File

@ -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.