Codebase list glance / ced3d83
Merge "Call monkey_patch before other modules are loaded" into stable/grizzly Jenkins authored 10 years ago Gerrit Code Review committed 10 years ago
4 changed file(s) with 8 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
2121 Glance API Server
2222 """
2323
24 import eventlet
2425 import gettext
2526 import os
2627 import sys
28
29 # Monkey patch socket and time
30 eventlet.patcher.monkey_patch(all=False, socket=True, time=True)
2731
2832 # If ../glance/__init__.py exists, add ../ to Python search path, so that
2933 # it will override what happens to be installed in /usr/(local/)lib/python...
2121 Reference implementation server for Glance Registry
2222 """
2323
24 import eventlet
2425 import gettext
2526 import os
2627 import sys
28
29 # Monkey patch socket and time
30 eventlet.patcher.monkey_patch(all=False, socket=True, time=True)
2731
2832 # If ../glance/__init__.py exists, add ../ to Python search path, so that
2933 # it will override what happens to be installed in /usr/(local/)lib/python...
218218 self.run_child()
219219
220220 def create_pool(self):
221 eventlet.patcher.monkey_patch(all=False, socket=True, time=True)
222221 return eventlet.GreenPool(size=self.threads)
223222
224223 def wait_on_children(self):
246246 self.assertEqual(v, result[k])
247247 else:
248248 self.assertFalse(k in result)
249
250
251 class TestMonkeyPatch(test_utils.BaseTestCase):
252
253 def test_time_is_monkey_patched(self):
254 """
255 Test GET with no redirect
256 """
257 server = wsgi.Server()
258 server.create_pool()
259 self.assertTrue(eventlet.patcher.is_monkey_patched(time))
260 self.assertTrue(eventlet.patcher.is_monkey_patched(socket))