Much easier to just use the blanket defaults. :)

This commit is contained in:
Ryan Williams
2010-02-24 23:27:45 -08:00
parent 4ec2cc509f
commit b0ae4f81c6
2 changed files with 12 additions and 11 deletions

View File

@@ -81,6 +81,15 @@ def import_patched(module_name, *additional_modules, **kw_additional_modules):
def patch_function(func, *additional_modules):
"""Huge hack here -- patches the specified modules for the
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):
saved = {}
for name, mod in additional_modules:

View File

@@ -2,8 +2,6 @@
from eventlet import patcher
from eventlet.green import socket
from eventlet.green import urllib
from eventlet.green import threading
# enable network resource
import test.test_support
@@ -21,16 +19,10 @@ try:
except AttributeError:
raise ImportError("Socket module doesn't support ssl")
patcher.inject('test.test_socket_ssl',
globals(),
('socket', socket),
('urllib', urllib),
('threading', threading))
patcher.inject('test.test_socket_ssl', globals())
test_basic = patcher.patch_function(test_basic,
('urllib', urllib))
test_rude_shutdown = patcher.patch_function(test_rude_shutdown,
('threading', threading))
test_basic = patcher.patch_function(test_basic)
test_rude_shutdown = patcher.patch_function(test_rude_shutdown)
def test_main():
if not hasattr(socket, "ssl"):