Move monkey patch to keystone-all startup.

bug 1020569

Change-Id: I26c467dc6d96476f2a44b875bddf2cf3aec41859
This commit is contained in:
Adam Young 2012-07-03 16:22:13 -04:00
parent f584c06aaa
commit 81cb2ab2f5
3 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
import greenlet import greenlet
import eventlet
import logging import logging
import os import os
import signal import signal
@ -17,6 +18,8 @@ if os.path.exists(os.path.join(possible_topdir,
'__init__.py')): '__init__.py')):
sys.path.insert(0, possible_topdir) sys.path.insert(0, possible_topdir)
eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=True)
from paste import deploy from paste import deploy
from keystone import config from keystone import config

View File

@ -23,7 +23,6 @@
import sys import sys
import eventlet.wsgi import eventlet.wsgi
eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=True)
import routes.middleware import routes.middleware
import ssl import ssl
import webob.dec import webob.dec

View File

@ -55,7 +55,7 @@ To run a single test module:
python run_tests.py api.test_wsgi python run_tests.py api.test_wsgi
""" """
import eventlet
import heapq import heapq
import os import os
import unittest import unittest
@ -337,6 +337,7 @@ if __name__ == '__main__':
# If any argument looks like a test name but doesn't have "nova.tests" in # If any argument looks like a test name but doesn't have "nova.tests" in
# front of it, automatically add that so we don't have to type as much # front of it, automatically add that so we don't have to type as much
show_elapsed = True show_elapsed = True
do_monkeypatch = True
argv = [] argv = []
for x in sys.argv: for x in sys.argv:
if x.startswith('test_'): if x.startswith('test_'):
@ -345,9 +346,13 @@ if __name__ == '__main__':
argv.append(x) argv.append(x)
elif x.startswith('--hide-elapsed'): elif x.startswith('--hide-elapsed'):
show_elapsed = False show_elapsed = False
elif x.startswith('--no-monkeypatch'):
do_monkeypatch = False
else: else:
argv.append(x) argv.append(x)
if do_monkeypatch:
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
thread=True)
testdir = os.path.abspath(os.path.join("tests")) testdir = os.path.abspath(os.path.join("tests"))
c = config.Config(stream=sys.stdout, c = config.Config(stream=sys.stdout,
env=os.environ, env=os.environ,