eventlet monkey patch in unit tests earlier
It's important for consistent behavior to monkey_patch eventlet before importing anything. While it makes an attempt to green any existing created objects or locks, that code is buggy and fails in some cases -- especially around rlocks. It's not my belief that this resolves any specific bugs, but this does reflect a better overall practice. Change-Id: I57b2c91f9853287a08ee79ac87ae6e1767ddfb6f
This commit is contained in:
parent
a2085aa1a6
commit
b9baf7dbc8
@ -22,15 +22,20 @@
|
||||
:platform: Unix
|
||||
"""
|
||||
|
||||
# TODO(tenbrae): 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()
|
||||
# NOTE(JayF): We must green all python stdlib modules before anything else
|
||||
# is imported for consistent behavior. For instance, sqlalchemy
|
||||
# creates a threading.RLock early, and if it was imported before
|
||||
eventlet.monkey_patch() # noqa
|
||||
|
||||
|
||||
from oslo_config import cfg # noqa E402
|
||||
from oslo_log import log # noqa E402
|
||||
|
||||
from ironic import objects # noqa E402
|
||||
|
||||
|
||||
log.register_options(cfg.CONF)
|
||||
log.setup(cfg.CONF, 'ironic')
|
||||
|
Loading…
Reference in New Issue
Block a user