diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 926b2ce9ae..fd8b231a24 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,7 @@ Changed packages. Also add support for multiple runners (runner modules) inside a single Python package and consolidate Python packages from two to one for the following runners: local runners, remote runners, windows runners. (improvement) #3999 +* Upgrade eventlet library to the latest stable version (0.22.1) (improvement) #4007 Fixed ~~~~~ diff --git a/contrib/packs/tests/test_action_download.py b/contrib/packs/tests/test_action_download.py index 59509bc017..c951089c09 100644 --- a/contrib/packs/tests/test_action_download.py +++ b/contrib/packs/tests/test_action_download.py @@ -21,6 +21,9 @@ import tempfile import hashlib +from st2common.util.monkey_patch import use_select_poll_workaround +use_select_poll_workaround() + from lockfile import LockFile from lockfile import LockTimeout from git.repo import Repo diff --git a/contrib/packs/tests/test_action_unload.py b/contrib/packs/tests/test_action_unload.py index df8657eaa6..2fe6dbbcec 100644 --- a/contrib/packs/tests/test_action_unload.py +++ b/contrib/packs/tests/test_action_unload.py @@ -19,6 +19,9 @@ from oslo_config import cfg +from st2common.util.monkey_patch import use_select_poll_workaround +use_select_poll_workaround() + from st2common.content.bootstrap import register_content from st2common.persistence.pack import Pack from st2common.persistence.pack import Config diff --git a/fixed-requirements.txt b/fixed-requirements.txt index d18c44b8f8..fa0eb9fe6f 100644 --- a/fixed-requirements.txt +++ b/fixed-requirements.txt @@ -3,7 +3,7 @@ greenlet==0.4.12 # Note: 0.20.0 removed select.poll() on which some of our code and libraries we # depend on rely -eventlet==0.19.0 +eventlet==0.22.1 gunicorn==19.7.1 kombu==4.1.0 # Note: amqp is used by kombu diff --git a/requirements.txt b/requirements.txt index 3ae548afe6..1610f2f6ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ apscheduler==3.4.0 argcomplete bcrypt -eventlet==0.19.0 +eventlet==0.22.1 flex==6.11.1 git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient diff --git a/st2common/st2common/util/monkey_patch.py b/st2common/st2common/util/monkey_patch.py index 3989cabffe..d3e0254b22 100644 --- a/st2common/st2common/util/monkey_patch.py +++ b/st2common/st2common/util/monkey_patch.py @@ -23,6 +23,7 @@ __all__ = [ 'monkey_patch', + 'use_select_poll_workaround', 'is_use_debugger_flag_provided' ] @@ -44,6 +45,21 @@ def monkey_patch(): eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True) +def use_select_poll_workaround(): + """ + Work around for some tests which injects original select module with select.poll() + available to sys.modules. + """ + import sys + import subprocess + import eventlet + + # Work around to get tests to pass with eventlet >= 0.20.0 + if 'nose' in sys.modules.keys(): + sys.modules['select'] = eventlet.patcher.original('select') + subprocess.select = eventlet.patcher.original('select') + + def is_use_debugger_flag_provided(): # 1. Check sys.argv directly if USE_DEBUGGER_FLAG in sys.argv: diff --git a/st2common/tests/unit/test_pack_management.py b/st2common/tests/unit/test_pack_management.py index 0fc2459de4..0f15b49a60 100644 --- a/st2common/tests/unit/test_pack_management.py +++ b/st2common/tests/unit/test_pack_management.py @@ -14,6 +14,7 @@ # limitations under the License. from __future__ import absolute_import + import os import sys @@ -25,8 +26,15 @@ sys.path.insert(0, PACK_ACTIONS_DIR) +from st2common.util.monkey_patch import use_select_poll_workaround +use_select_poll_workaround() + from pack_mgmt.download import DownloadGitRepoAction +__all__ = [ + 'InstallPackTestCase' +] + class InstallPackTestCase(unittest2.TestCase):