summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-08-02 13:55:23 +0000
committerGerrit Code Review <review@openstack.org>2013-08-02 13:55:23 +0000
commita117358d4215ad5ccbc378107f69966abe14bb2a (patch)
treeb29c17bfc230070672be081130e044e53b414ed1 /tests/unit
parent466f1391545d4a01b31b12c5dac1c0d84b0ad2d6 (diff)
parentcb2a2b6e234be9cb5a63409b5c7594cf6ac4a9d0 (diff)
downloadoslo-a117358d4215ad5ccbc378107f69966abe14bb2a.tar.gz
oslo-a117358d4215ad5ccbc378107f69966abe14bb2a.tar.xz
oslo-a117358d4215ad5ccbc378107f69966abe14bb2a.zip
Merge "Modify local.py to not be dependent on Eventlet"
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_local.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/unit/test_local.py b/tests/unit/test_local.py
index 37e5798..bc7b05d 100644
--- a/tests/unit/test_local.py
+++ b/tests/unit/test_local.py
@@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import eventlet
+import threading
from openstack.common import local
from tests import utils
@@ -31,6 +31,15 @@ class LocalStoreTestCase(utils.BaseTestCase):
v2 = Dict(a='2')
v3 = Dict(a='3')
+ def setUp(self):
+ super(LocalStoreTestCase, self).setUp()
+ # NOTE(mrodden): we need to make sure that local store
+ # gets imported in the current python context we are
+ # testing in (eventlet vs normal python threading) so
+ # we test the correct type of local store for the current
+ # threading model
+ reload(local)
+
def test_thread_unique_storage(self):
"""Make sure local store holds thread specific values."""
expected_set = []
@@ -44,8 +53,13 @@ class LocalStoreTestCase(utils.BaseTestCase):
local.store.a = self.v3
expected_set.append(getattr(local.store, 'a'))
- eventlet.spawn(do_something).wait()
- eventlet.spawn(do_something2).wait()
+ t1 = threading.Thread(target=do_something)
+ t2 = threading.Thread(target=do_something2)
+ t1.start()
+ t2.start()
+ t1.join()
+ t2.join()
+
expected_set.append(getattr(local.store, 'a'))
self.assertTrue(self.v1 in expected_set)