Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the issue, where is_monkey_patch() returning false for threading, Queue module. #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions eventlet/patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,12 @@ def monkey_patch(**on):
if on['socket'] and not already_patched.get('socket'):
modules_to_patch += _green_socket_modules()
already_patched['socket'] = True
already_patched['ssl'] = True
if on['thread'] and not already_patched.get('thread'):
modules_to_patch += _green_thread_modules()
already_patched['thread'] = True
already_patched['Queue'] = True
already_patched['threading'] = True
if on['time'] and not already_patched.get('time'):
modules_to_patch += _green_time_modules()
already_patched['time'] = True
Expand Down
14 changes: 7 additions & 7 deletions tests/patcher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ def assert_boolean_logic(self, call, expected, not_expected=''):

def test_boolean(self):
self.assert_boolean_logic("patcher.monkey_patch()",
'os,select,socket,thread,time')
'Queue,os,select,socket,ssl,thread,threading,time')

def test_boolean_all(self):
self.assert_boolean_logic("patcher.monkey_patch(all=True)",
'os,select,socket,thread,time')
'Queue,os,select,socket,ssl,thread,threading,time')

def test_boolean_all_single(self):
self.assert_boolean_logic("patcher.monkey_patch(all=True, socket=True)",
'os,select,socket,thread,time')
'Queue,os,select,socket,ssl,thread,threading,time')

def test_boolean_all_negative(self):
self.assert_boolean_logic(
Expand All @@ -202,19 +202,19 @@ def test_boolean_all_negative(self):

def test_boolean_single(self):
self.assert_boolean_logic("patcher.monkey_patch(socket=True)",
'socket')
'socket,ssl')

def test_boolean_double(self):
self.assert_boolean_logic("patcher.monkey_patch(socket=True, select=True)",
'select,socket')
'select,socket,ssl')

def test_boolean_negative(self):
self.assert_boolean_logic("patcher.monkey_patch(socket=False)",
'os,select,thread,time')
'Queue,os,select,thread,threading,time')

def test_boolean_negative2(self):
self.assert_boolean_logic("patcher.monkey_patch(socket=False, time=False)",
'os,select,thread')
'Queue,os,select,thread,threading')

def test_conflicting_specifications(self):
self.assert_boolean_logic("patcher.monkey_patch(socket=False, select=True)",
Expand Down