summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Nemec <bnemec@redhat.com>2014-10-03 23:22:36 +0000
committerBen Nemec <bnemec@redhat.com>2014-10-03 23:27:36 +0000
commit8483811889baa2c9f839c1ccbf74d2c14174bd67 (patch)
tree55c245b117812abd662d54216211db8c8ed9a4a2
parentad4e21c83a87d598af953550aee2069407702a37 (diff)
downloadoslo-concurrency-8483811889baa2c9f839c1ccbf74d2c14174bd67.tar.gz
Test with both vanilla and eventlet stdlib
We intend this project's code to function both with and without eventlet monkey patching, so we should test that way too. This adds a separate test run that explicitly enables eventlet and removes the racy monkey patching that existed before. I left the eventlet-specific unit test because it's making direct calls into eventlet, so it is a somewhat different case from implicitly using monkey patched classes and I'd rather leave a redundant test than remove it and find out it covered something the others don't. Change-Id: Idbe9cdd90e9ce5e38b03ec1c20066928daa9ef00 Closes-Bug: 1367966
-rw-r--r--tests/__init__.py19
-rw-r--r--tests/unit/test_lockutils_eventlet.py1
-rw-r--r--tox.ini2
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index e69de29..b4d424e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -0,0 +1,19 @@
+# Copyright 2014 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+
+if os.environ.get('TEST_EVENTLET'):
+ import eventlet
+ eventlet.monkey_patch() \ No newline at end of file
diff --git a/tests/unit/test_lockutils_eventlet.py b/tests/unit/test_lockutils_eventlet.py
index 9a5e1c3..41c19c6 100644
--- a/tests/unit/test_lockutils_eventlet.py
+++ b/tests/unit/test_lockutils_eventlet.py
@@ -17,7 +17,6 @@ import shutil
import tempfile
import eventlet
-eventlet.monkey_patch()
from eventlet import greenpool
from oslotest import base as test_base
diff --git a/tox.ini b/tox.ini
index 13cae6b..2f1a852 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,8 +14,10 @@ setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
+# We want to support both vanilla stdlib and eventlet monkey patched
commands =
lockutils-wrapper python setup.py testr --slowest --testr-args='{posargs}'
+ env TEST_EVENTLET=1 lockutils-wrapper python setup.py testr --slowest --testr-args='{posargs}'
[testenv:py33]
deps = -r{toxinidir}/requirements-py3.txt