Much easier to just use the blanket defaults. :)
This commit is contained in:
@@ -81,6 +81,15 @@ def import_patched(module_name, *additional_modules, **kw_additional_modules):
|
|||||||
def patch_function(func, *additional_modules):
|
def patch_function(func, *additional_modules):
|
||||||
"""Huge hack here -- patches the specified modules for the
|
"""Huge hack here -- patches the specified modules for the
|
||||||
duration of the function call."""
|
duration of the function call."""
|
||||||
|
if not additional_modules:
|
||||||
|
# supply some defaults
|
||||||
|
additional_modules = (
|
||||||
|
_green_os_modules() +
|
||||||
|
_green_select_modules() +
|
||||||
|
_green_socket_modules() +
|
||||||
|
_green_thread_modules() +
|
||||||
|
_green_time_modules())
|
||||||
|
|
||||||
def patched(*args, **kw):
|
def patched(*args, **kw):
|
||||||
saved = {}
|
saved = {}
|
||||||
for name, mod in additional_modules:
|
for name, mod in additional_modules:
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
from eventlet import patcher
|
from eventlet import patcher
|
||||||
from eventlet.green import socket
|
from eventlet.green import socket
|
||||||
from eventlet.green import urllib
|
|
||||||
from eventlet.green import threading
|
|
||||||
|
|
||||||
# enable network resource
|
# enable network resource
|
||||||
import test.test_support
|
import test.test_support
|
||||||
@@ -21,16 +19,10 @@ try:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise ImportError("Socket module doesn't support ssl")
|
raise ImportError("Socket module doesn't support ssl")
|
||||||
|
|
||||||
patcher.inject('test.test_socket_ssl',
|
patcher.inject('test.test_socket_ssl', globals())
|
||||||
globals(),
|
|
||||||
('socket', socket),
|
|
||||||
('urllib', urllib),
|
|
||||||
('threading', threading))
|
|
||||||
|
|
||||||
test_basic = patcher.patch_function(test_basic,
|
test_basic = patcher.patch_function(test_basic)
|
||||||
('urllib', urllib))
|
test_rude_shutdown = patcher.patch_function(test_rude_shutdown)
|
||||||
test_rude_shutdown = patcher.patch_function(test_rude_shutdown,
|
|
||||||
('threading', threading))
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
if not hasattr(socket, "ssl"):
|
if not hasattr(socket, "ssl"):
|
||||||
|
Reference in New Issue
Block a user