Monkey patch threading module as early as possible

In oslo.messaging, local thread store is used to pass RPC request
context [1]. If we try to import oslo.messaging before monkey patching
threading library, it attempts to access unpatched storage and fails
with AttributeError.

[1]: oslo/messaging/localcontext.py#L26

blueprint oslo-messaging

Change-Id: Ied7302fcb1d3e14428540e39e3db704550027890
This commit is contained in:
Ihar Hrachyshka
2014-05-30 15:53:25 +02:00
parent fc8546d8c0
commit 161ec8341b
27 changed files with 96 additions and 96 deletions

View File

@@ -42,12 +42,10 @@ class TestLbaasService(base.BaseTestCase):
with contextlib.nested(
mock.patch(logging_str),
mock.patch.object(agent.service, 'launch'),
mock.patch.object(agent, 'eventlet'),
mock.patch('sys.argv'),
mock.patch.object(agent.manager, 'LbaasAgentManager'),
mock.patch.object(cfg.CONF, 'register_opts')
) as (mock_logging, mock_launch, mock_eventlet, sys_argv, mgr_cls, ro):
) as (mock_logging, mock_launch, sys_argv, mgr_cls, ro):
agent.main()
self.assertTrue(mock_eventlet.monkey_patch.called)
mock_launch.assert_called_once_with(mock.ANY)