diff --git a/setup.py b/setup.py index f7cb93b1..8539ec2c 100644 --- a/setup.py +++ b/setup.py @@ -15,13 +15,14 @@ from __future__ import print_function import sys -import ez_setup -ez_setup.use_setuptools() - if __name__ == '__main__' and sys.argv[1] == "gevent_nosetests": + print("Running gevent tests") from gevent.monkey import patch_all patch_all() +import ez_setup +ez_setup.use_setuptools() + from setuptools import setup from distutils.command.build_ext import build_ext from distutils.core import Extension diff --git a/tests/unit/io/test_asyncorereactor.py b/tests/unit/io/test_asyncorereactor.py index 5ab59670..6acb1ef8 100644 --- a/tests/unit/io/test_asyncorereactor.py +++ b/tests/unit/io/test_asyncorereactor.py @@ -11,6 +11,7 @@ # 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 sys import six try: @@ -42,6 +43,8 @@ class AsyncoreConnectionTest(unittest.TestCase): @classmethod def setUpClass(cls): + if 'gevent.monkey' in sys.modules: + raise unittest.SkipTest("gevent monkey-patching detected") AsyncoreConnection.initialize_reactor() cls.socket_patcher = patch('socket.socket', spec=socket.socket) cls.mock_socket = cls.socket_patcher.start() diff --git a/tests/unit/io/test_libevreactor.py b/tests/unit/io/test_libevreactor.py index 3b677ab5..78e08f27 100644 --- a/tests/unit/io/test_libevreactor.py +++ b/tests/unit/io/test_libevreactor.py @@ -11,7 +11,6 @@ # 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. - try: import unittest2 as unittest except ImportError: @@ -19,6 +18,7 @@ except ImportError: import errno import os +import sys import six from six import BytesIO @@ -48,6 +48,8 @@ except ImportError: class LibevConnectionTest(unittest.TestCase): def setUp(self): + if 'gevent.monkey' in sys.modules: + raise unittest.SkipTest("gevent monkey-patching detected") if LibevConnection is None: raise unittest.SkipTest('libev does not appear to be installed correctly') LibevConnection.initialize_reactor()