summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Dayne <huyueheng@inspur.com>2020-05-08 19:41:31 +0800
committerArthur Dayne <huyueheng@inspur.com>2020-05-08 19:42:26 +0800
commit9168889dbaa2db9ec8a72dea72c2bc1e13f60e6a (patch)
tree5a011ac3109b7a16ecee39ef0cfef6227ff471e1
parentc5e0dfedf9a3e5a847a5e01bb81db8ce6e3d042d (diff)
downloadoslo-concurrency-9168889dbaa2db9ec8a72dea72c2bc1e13f60e6a.tar.gz
Monkey patch original current_thread _active
Monkey patch the original current_thread to use the up-to-date _active global variable. This solution is based on that documented at: https://github.com/eventlet/eventlet/issues/592 Change-Id: I876e2825da628d51c9977a4eec0c2ef05aed3229 Closes-Bug: #1863021
-rw-r--r--oslo_concurrency/tests/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/oslo_concurrency/tests/__init__.py b/oslo_concurrency/tests/__init__.py
index bd455c4..73122fb 100644
--- a/oslo_concurrency/tests/__init__.py
+++ b/oslo_concurrency/tests/__init__.py
@@ -17,3 +17,9 @@ import os
if os.environ.get('TEST_EVENTLET'):
import eventlet
eventlet.monkey_patch()
+ # Monkey patch the original current_thread to use the up-to-date _active
+ # global variable. See https://bugs.launchpad.net/bugs/1863021 and
+ # https://github.com/eventlet/eventlet/issues/592
+ import __original_module_threading as orig_threading # noqa
+ import threading # noqa
+ orig_threading.current_thread.__globals__['_active'] = threading._active