summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Shepelev <temotor@gmail.com>2018-02-17 22:41:37 +0300
committerSergey Shepelev <temotor@gmail.com>2023-01-22 03:26:31 +0300
commit80b7cfaf86e9d787250c1a3924248a22c8b6baad (patch)
treed6a9d9bb80b4d974497e7142f3acab934d893e5e
parent3740657dd7f01f0630a8753f9d7434bff3875d82 (diff)
downloadeventlet-80b7cfaf86e9d787250c1a3924248a22c8b6baad.tar.gz
hubs: drop pyevent hub
https://github.com/eventlet/eventlet/pull/657
-rw-r--r--benchmarks/context.py19
-rw-r--r--doc/hubs.rst26
-rw-r--r--doc/threading.rst2
-rw-r--r--eventlet/hubs/__init__.py3
-rw-r--r--eventlet/hubs/pyevent.py197
-rw-r--r--tests/__init__.py10
-rw-r--r--tests/db_pool_test.py1
-rw-r--r--tests/env_test.py1
-rw-r--r--tests/greenio_test.py3
-rw-r--r--tests/hub_test.py13
-rw-r--r--tests/mysqldb_test.py13
-rw-r--r--tests/patcher_test.py3
-rw-r--r--tests/stdlib/all.py16
-rw-r--r--tests/stdlib/test_asyncore.py11
-rw-r--r--tests/stdlib/test_ftplib.py6
-rw-r--r--tests/stdlib/test_socketserver.py10
-rw-r--r--tests/timer_test.py3
-rw-r--r--tests/tpool_test.py29
-rw-r--r--tests/wsgi_test.py1
-rw-r--r--tests/zmq_test.py2
20 files changed, 43 insertions, 326 deletions
diff --git a/benchmarks/context.py b/benchmarks/context.py
index d9b564d..dd3ac9a 100644
--- a/benchmarks/context.py
+++ b/benchmarks/context.py
@@ -5,8 +5,7 @@ import threading
import time
import eventlet
-from eventlet import hubs
-from eventlet.hubs import pyevent, epolls, poll, selects
+import eventlet.hubs
CONTEXT_SWITCHES = 100000
@@ -65,23 +64,23 @@ test_thread()
print("threading: %.02f seconds" % (time.time() - start))
try:
- hubs.use_hub(pyevent)
+ eventlet.hubs.use_hub("eventlet.hubs.epolls")
start = time.time()
test_eventlet()
- print("pyevent: %.02f seconds" % (time.time() - start))
+ print("epoll: %.02f seconds" % (time.time() - start))
except:
- print("pyevent hub unavailable")
+ print("epoll hub unavailable")
try:
- hubs.use_hub(epolls)
+ eventlet.hubs.use_hub("eventlet.hubs.kqueue")
start = time.time()
test_eventlet()
- print("epoll: %.02f seconds" % (time.time() - start))
+ print("kqueue: %.02f seconds" % (time.time() - start))
except:
- print("epoll hub unavailable")
+ print("kqueue hub unavailable")
try:
- hubs.use_hub(poll)
+ eventlet.hubs.use_hub("eventlet.hubs.poll")
start = time.time()
test_eventlet()
print("poll: %.02f seconds" % (time.time() - start))
@@ -89,7 +88,7 @@ except:
print("poll hub unavailable")
try:
- hubs.use_hub(selects)
+ eventlet.hubs.use_hub("eventlet.hubs.selects")
start = time.time()
test_eventlet()
print("select: %.02f seconds" % (time.time() - start))
diff --git a/doc/hubs.rst b/doc/hubs.rst
index 7c7e79e..150c1ba 100644
--- a/doc/hubs.rst
+++ b/doc/hubs.rst
@@ -8,31 +8,33 @@ A hub forms the basis of Eventlet's event loop, which dispatches I/O events and
Eventlet has multiple hub implementations, and when you start using it, it tries to select the best hub implementation for your system. The hubs that it supports are (in order of preference):
**epolls**
- Linux.
+ Linux. This is the fastest hub for Linux.
+**kqueue**
+ FreeBSD and Mac OSX. Fastest hub for OS with kqueue.
**poll**
- On platforms that support it
+ On platforms that support it.
**selects**
Lowest-common-denominator, available everywhere.
-**pyevent**
- This is a libevent-based backend and is thus the fastest. It's disabled by default, because it does not support native threads, but you can enable it yourself if your use case doesn't require them. (You have to install pyevent, too.)
-If the selected hub is not ideal for the application, another can be selected. You can make the selection either with the environment variable :ref:`EVENTLET_HUB <env_vars>`, or with use_hub.
+The only non-pure Python, pyevent hub (using libevent) was removed because it was not maintained. You are warmly welcome to contribute fast hub implementation using Cython, CFFI or other technology of your choice.
+
+If the selected hub is not ideal for the application, another can be selected. You can make the selection either with the environment variable :ref:`EVENTLET_HUB <env_vars>`, or with :func:`eventlet.hubs.use_hub`.
.. function:: eventlet.hubs.use_hub(hub=None)
Use this to control which hub Eventlet selects. Call it with the name of the desired hub module. Make sure to do this before the application starts doing any I/O! Calling use_hub completely eliminates the old hub, and any file descriptors or timers that it had been managing will be forgotten. Put the call as one of the first lines in the main module.::
""" This is the main module """
- from eventlet import hubs
- hubs.use_hub("pyevent")
+ import eventlet.hubs
+ eventlet.hubs.use_hub("eventlet.hubs.epolls")
Hubs are implemented as thread-local class instances. :func:`eventlet.hubs.use_hub` only operates on the current thread. When using multiple threads that each need their own hub, call :func:`eventlet.hubs.use_hub` at the beginning of each thread function that needs a specific hub. In practice, it may not be necessary to specify a hub in each thread; it works to use one special hub for the main thread, and let other threads use the default hub; this hybrid hub configuration will work fine.
It is also possible to use a third-party hub module in place of one of the built-in ones. Simply pass the module itself to :func:`eventlet.hubs.use_hub`. The task of writing such a hub is a little beyond the scope of this document, it's probably a good idea to simply inspect the code of the existing hubs to see how they work.::
- from eventlet import hubs
- from mypackage import myhub
- hubs.use_hub(myhub)
+ import eventlet.hubs
+ import mypackage.myhub
+ eventlet.hubs.use_hub(mypackage.myhub)
Supplying None as the argument to :func:`eventlet.hubs.use_hub` causes it to select the default hub.
@@ -43,10 +45,10 @@ How the Hubs Work
The hub has a main greenlet, MAINLOOP. When one of the running coroutines needs
to do some I/O, it registers a listener with the hub (so that the hub knows when to wake it up again), and then switches to MAINLOOP (via ``get_hub().switch()``). If there are other coroutines that are ready to run, MAINLOOP switches to them, and when they complete or need to do more I/O, they switch back to the MAINLOOP. In this manner, MAINLOOP ensures that every coroutine gets scheduled when it has some work to do.
-MAINLOOP is launched only when the first I/O operation happens, and it is not the same greenlet that __main__ is running in. This lazy launching is why it's not necessary to explicitly call a dispatch() method like other frameworks, which in turn means that code can start using Eventlet without needing to be substantially restructured.
+MAINLOOP is launched only when the first I/O operation happens, and it is not the same greenlet that __main__ is running in. This lazy launching means that code can start using Eventlet without needing to be substantially restructured.
More Hub-Related Functions
----------------------------
+--------------------------
.. autofunction:: eventlet.hubs.get_hub
.. autofunction:: eventlet.hubs.get_default_hub
diff --git a/doc/threading.rst b/doc/threading.rst
index 3a0486e..7e91db6 100644
--- a/doc/threading.rst
+++ b/doc/threading.rst
@@ -9,8 +9,6 @@ You can only communicate cross-thread using the "real" thread primitives and pip
The vast majority of the times you'll want to use threads are to wrap some operation that is not "green", such as a C library that uses its own OS calls to do socket operations. The :mod:`~eventlet.tpool` module is provided to make these uses simpler.
-The optional :ref:`pyevent hub <understanding_hubs>` is not compatible with threads.
-
Tpool - Simple thread pool
---------------------------
diff --git a/eventlet/hubs/__init__.py b/eventlet/hubs/__init__.py
index 867628c..9aa2f52 100644
--- a/eventlet/hubs/__init__.py
+++ b/eventlet/hubs/__init__.py
@@ -32,9 +32,6 @@ def get_default_hub():
* poll
* select
- It won't automatically select the pyevent hub, because it's not
- python-thread-safe.
-
.. include:: ../doc/common.txt
.. note :: |internal|
"""
diff --git a/eventlet/hubs/pyevent.py b/eventlet/hubs/pyevent.py
index 503aad4..0802243 100644
--- a/eventlet/hubs/pyevent.py
+++ b/eventlet/hubs/pyevent.py
@@ -1,193 +1,4 @@
-import sys
-import traceback
-import types
-import warnings
-
-from eventlet.support import greenlets as greenlet
-import six
-from eventlet.hubs.hub import BaseHub, READ, WRITE
-
-try:
- import event
-except ImportError:
- event = None
-
-
-def is_available():
- return event is not None
-
-
-class event_wrapper(object):
-
- def __init__(self, impl=None, seconds=None):
- self.impl = impl
- self.seconds = seconds
-
- def __repr__(self):
- if self.impl is not None:
- return repr(self.impl)
- else:
- return object.__repr__(self)
-
- def __str__(self):
- if self.impl is not None:
- return str(self.impl)
- else:
- return object.__str__(self)
-
- def cancel(self):
- if self.impl is not None:
- self.impl.delete()
- self.impl = None
-
- @property
- def pending(self):
- return bool(self.impl and self.impl.pending())
-
-
-class Hub(BaseHub):
-
- SYSTEM_EXCEPTIONS = (KeyboardInterrupt, SystemExit)
-
- def __init__(self):
- super(Hub, self).__init__()
- event.init()
-
- self.signal_exc_info = None
- self.signal(
- 2,
- lambda signalnum, frame: self.greenlet.parent.throw(KeyboardInterrupt))
- self.events_to_add = []
-
- warnings.warn(
- "ACTION REQUIRED eventlet pyevent hub is deprecated and will be removed soon",
- DeprecationWarning,
- )
-
- def dispatch(self):
- loop = event.loop
- while True:
- for e in self.events_to_add:
- if e is not None and e.impl is not None and e.seconds is not None:
- e.impl.add(e.seconds)
- e.seconds = None
- self.events_to_add = []
- result = loop()
-
- if getattr(event, '__event_exc', None) is not None:
- # only have to do this because of bug in event.loop
- t = getattr(event, '__event_exc')
- setattr(event, '__event_exc', None)
- assert getattr(event, '__event_exc') is None
- six.reraise(t[0], t[1], t[2])
-
- if result != 0:
- return result
-
- def run(self):
- while True:
- try:
- self.dispatch()
- except greenlet.GreenletExit:
- break
- except self.SYSTEM_EXCEPTIONS:
- raise
- except:
- if self.signal_exc_info is not None:
- self.schedule_call_global(
- 0, greenlet.getcurrent().parent.throw, *self.signal_exc_info)
- self.signal_exc_info = None
- else:
- self.squelch_timer_exception(None, sys.exc_info())
-
- def abort(self, wait=True):
- self.schedule_call_global(0, self.greenlet.throw, greenlet.GreenletExit)
- if wait:
- assert self.greenlet is not greenlet.getcurrent(
- ), "Can't abort with wait from inside the hub's greenlet."
- self.switch()
-
- def _getrunning(self):
- return bool(self.greenlet)
-
- def _setrunning(self, value):
- pass # exists for compatibility with BaseHub
- running = property(_getrunning, _setrunning)
-
- def add(self, evtype, fileno, real_cb, real_tb, mac):
- # this is stupid: pyevent won't call a callback unless it's a function,
- # so we have to force it to be one here
- if isinstance(real_cb, types.BuiltinMethodType):
- def cb(_d):
- real_cb(_d)
- else:
- cb = real_cb
-
- if evtype is READ:
- evt = event.read(fileno, cb, fileno)
- elif evtype is WRITE:
- evt = event.write(fileno, cb, fileno)
-
- return super(Hub, self).add(evtype, fileno, evt, real_tb, mac)
-
- def signal(self, signalnum, handler):
- def wrapper():
- try:
- handler(signalnum, None)
- except:
- self.signal_exc_info = sys.exc_info()
- event.abort()
- return event_wrapper(event.signal(signalnum, wrapper))
-
- def remove(self, listener):
- super(Hub, self).remove(listener)
- listener.cb.delete()
-
- def remove_descriptor(self, fileno):
- for lcontainer in six.itervalues(self.listeners):
- listener = lcontainer.pop(fileno, None)
- if listener:
- try:
- listener.cb.delete()
- except self.SYSTEM_EXCEPTIONS:
- raise
- except:
- traceback.print_exc()
-
- def schedule_call_local(self, seconds, cb, *args, **kwargs):
- current = greenlet.getcurrent()
- if current is self.greenlet:
- return self.schedule_call_global(seconds, cb, *args, **kwargs)
- event_impl = event.event(_scheduled_call_local, (cb, args, kwargs, current))
- wrapper = event_wrapper(event_impl, seconds=seconds)
- self.events_to_add.append(wrapper)
- return wrapper
-
- schedule_call = schedule_call_local
-
- def schedule_call_global(self, seconds, cb, *args, **kwargs):
- event_impl = event.event(_scheduled_call, (cb, args, kwargs))
- wrapper = event_wrapper(event_impl, seconds=seconds)
- self.events_to_add.append(wrapper)
- return wrapper
-
- def _version_info(self):
- baseversion = event.__version__
- return baseversion
-
-
-def _scheduled_call(event_impl, handle, evtype, arg):
- cb, args, kwargs = arg
- try:
- cb(*args, **kwargs)
- finally:
- event_impl.delete()
-
-
-def _scheduled_call_local(event_impl, handle, evtype, arg):
- cb, args, kwargs, caller_greenlet = arg
- try:
- if not caller_greenlet.dead:
- cb(*args, **kwargs)
- finally:
- event_impl.delete()
+raise ImportError(
+ "Eventlet pyevent hub was removed because it was not maintained."
+ " Try version 0.22.1 or older. Sorry for the inconvenience."
+)
diff --git a/tests/__init__.py b/tests/__init__.py
index 4a5204c..24a82e5 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -101,16 +101,6 @@ def skip_unless(condition):
return skipped_wrapper
-def using_pyevent(_f):
- from eventlet.hubs import get_hub
- return 'pyevent' in type(get_hub()).__module__
-
-
-def skip_with_pyevent(func):
- """ Decorator that skips a test if we're using the pyevent hub."""
- return skip_if(using_pyevent)(func)
-
-
def skip_on_windows(func):
""" Decorator that skips a test on Windows."""
return skip_if(sys.platform.startswith('win'))(func)
diff --git a/tests/db_pool_test.py b/tests/db_pool_test.py
index c22b72f..f5bc772 100644
--- a/tests/db_pool_test.py
+++ b/tests/db_pool_test.py
@@ -347,7 +347,6 @@ class TpoolConnectionPool(DBConnectionPool):
connect_timeout=connect_timeout,
**self._auth)
- @tests.skip_with_pyevent
def setUp(self):
super(TpoolConnectionPool, self).setUp()
diff --git a/tests/env_test.py b/tests/env_test.py
index 20a694d..076e6a2 100644
--- a/tests/env_test.py
+++ b/tests/env_test.py
@@ -27,7 +27,6 @@ print('pass')
)
-@tests.skip_with_pyevent
def test_tpool_size():
expected = '40'
normal = '20'
diff --git a/tests/greenio_test.py b/tests/greenio_test.py
index adae9af..318ac80 100644
--- a/tests/greenio_test.py
+++ b/tests/greenio_test.py
@@ -516,7 +516,6 @@ class TestGreenSocket(tests.LimitedTestCase):
server.close()
client.close()
- @tests.skip_with_pyevent
def test_raised_multiple_readers(self):
debug.hub_prevent_multiple_readers(True)
@@ -538,7 +537,6 @@ class TestGreenSocket(tests.LimitedTestCase):
s.sendall(b'b')
a.wait()
- @tests.skip_with_pyevent
@tests.skip_if(using_epoll_hub)
@tests.skip_if(using_kqueue_hub)
def test_closure(self):
@@ -860,7 +858,6 @@ class TestGreenPipe(tests.LimitedTestCase):
class TestGreenIoLong(tests.LimitedTestCase):
TEST_TIMEOUT = 10 # the test here might take a while depending on the OS
- @tests.skip_with_pyevent
def test_multiple_readers(self):
debug.hub_prevent_multiple_readers(False)
recvsize = 2 * min_buf_size()
diff --git a/tests/hub_test.py b/tests/hub_test.py
index a531b75..3f403b1 100644
--- a/tests/hub_test.py
+++ b/tests/hub_test.py
@@ -1,4 +1,3 @@
-from __future__ import with_statement
import errno
import fcntl
import os
@@ -6,7 +5,7 @@ import sys
import time
import tests
-from tests import skip_with_pyevent, skip_if_no_itimer, skip_unless
+from tests import skip_if_no_itimer, skip_unless
import eventlet
from eventlet import debug, hubs
from eventlet.support import greenlets
@@ -23,7 +22,6 @@ def noop():
class TestTimerCleanup(tests.LimitedTestCase):
TEST_TIMEOUT = 2
- @skip_with_pyevent
def test_cancel_immediate(self):
hub = hubs.get_hub()
stimers = hub.get_timers_count()
@@ -37,7 +35,6 @@ class TestTimerCleanup(tests.LimitedTestCase):
self.assert_less_than_equal(hub.get_timers_count(), 1000 + stimers)
self.assert_less_than_equal(hub.timers_canceled, 1000)
- @skip_with_pyevent
def test_cancel_accumulated(self):
hub = hubs.get_hub()
stimers = hub.get_timers_count()
@@ -54,7 +51,6 @@ class TestTimerCleanup(tests.LimitedTestCase):
self.assert_less_than_equal(hub.get_timers_count(), 1000 + stimers)
self.assert_less_than_equal(hub.timers_canceled, 1000)
- @skip_with_pyevent
def test_cancel_proportion(self):
# if fewer than half the pending timers are canceled, it should
# not clean them out
@@ -194,7 +190,7 @@ class TestExceptionInMainloop(tests.LimitedTestCase):
class TestExceptionInGreenthread(tests.LimitedTestCase):
- @skip_unless(greenlets.preserves_excinfo)
+ @tests.skip_unless(greenlets.preserves_excinfo)
def test_exceptionpreservation(self):
# events for controlling execution order
gt1event = eventlet.Event()
@@ -252,7 +248,6 @@ class TestExceptionInGreenthread(tests.LimitedTestCase):
class TestHubBlockingDetector(tests.LimitedTestCase):
TEST_TIMEOUT = 10
- @skip_with_pyevent
def test_block_detect(self):
def look_im_blocking():
import time
@@ -263,8 +258,7 @@ class TestHubBlockingDetector(tests.LimitedTestCase):
self.assertRaises(RuntimeError, gt.wait)
debug.hub_blocking_detection(False)
- @skip_with_pyevent
- @skip_if_no_itimer
+ @tests.skip_if_no_itimer
def test_block_detect_with_itimer(self):
def look_im_blocking():
import time
@@ -329,7 +323,6 @@ def test_repeated_select_bad_fd():
once()
-@skip_with_pyevent
def test_fork():
tests.run_isolated('hub_fork.py')
diff --git a/tests/mysqldb_test.py b/tests/mysqldb_test.py
index c5d1931..c800752 100644
--- a/tests/mysqldb_test.py
+++ b/tests/mysqldb_test.py
@@ -11,24 +11,21 @@ try:
except ImportError:
MySQLdb = False
import tests
-from tests import skip_unless, using_pyevent, get_database_auth
def mysql_requirement(_f):
- """We want to skip tests if using pyevent, MySQLdb is not installed, or if
+ """We want to skip tests if MySQLdb is not installed, or if
there is no database running on the localhost that the auth file grants
us access to.
This errs on the side of skipping tests if everything is not right, but
it's better than a million tests failing when you don't care about mysql
support."""
- if using_pyevent(_f):
- return False
if MySQLdb is False:
print("Skipping mysql tests, MySQLdb not importable")
return False
try:
- auth = get_database_auth()['MySQLdb'].copy()
+ auth = tests.get_database_auth()['MySQLdb'].copy()
MySQLdb.connect(**auth)
return True
except MySQLdb.OperationalError:
@@ -41,7 +38,7 @@ class TestMySQLdb(tests.LimitedTestCase):
TEST_TIMEOUT = 5
def setUp(self):
- self._auth = get_database_auth()['MySQLdb']
+ self._auth = tests.get_database_auth()['MySQLdb']
self.create_db()
self.connection = None
self.connection = MySQLdb.connect(**self._auth)
@@ -62,7 +59,7 @@ class TestMySQLdb(tests.LimitedTestCase):
super(TestMySQLdb, self).tearDown()
- @skip_unless(mysql_requirement)
+ @tests.skip_unless(mysql_requirement)
def create_db(self):
auth = self._auth.copy()
try:
@@ -229,6 +226,6 @@ class TestMySQLdb(tests.LimitedTestCase):
class TestMonkeyPatch(tests.LimitedTestCase):
- @skip_unless(mysql_requirement)
+ @tests.skip_unless(mysql_requirement)
def test_monkey_patching(self):
tests.run_isolated('mysqldb_monkey_patch.py')
diff --git a/tests/patcher_test.py b/tests/patcher_test.py
index dbf6e1c..de37fe8 100644
--- a/tests/patcher_test.py
+++ b/tests/patcher_test.py
@@ -233,7 +233,6 @@ def test_monkey_patch_threading():
class Tpool(ProcessBase):
TEST_TIMEOUT = 3
- @tests.skip_with_pyevent
def test_simple(self):
new_mod = """
import eventlet
@@ -251,7 +250,6 @@ tpool.killall()
assert '2' in lines[0], repr(output)
assert '3' in lines[1], repr(output)
- @tests.skip_with_pyevent
def test_unpatched_thread(self):
new_mod = """import eventlet
eventlet.monkey_patch(time=False, thread=False)
@@ -264,7 +262,6 @@ import time
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 2, lines)
- @tests.skip_with_pyevent
def test_patched_thread(self):
new_mod = """import eventlet
eventlet.monkey_patch(time=False, thread=True)
diff --git a/tests/stdlib/all.py b/tests/stdlib/all.py
index a4ddfd2..adf791f 100644
--- a/tests/stdlib/all.py
+++ b/tests/stdlib/all.py
@@ -10,18 +10,16 @@ Many of these tests make connections to external servers, and all.py tries to sk
tests rather than failing them, so you can get some work done on a plane.
"""
-from eventlet import debug
-debug.hub_prevent_multiple_readers(False)
+import eventlet.hubs
+import eventlet.debug
+eventlet.debug.hub_prevent_multiple_readers(False)
def restart_hub():
- from eventlet import hubs
- hub = hubs.get_hub()
- hub_shortname = hub.__module__.split('.')[-1]
- # don't restart the pyevent hub; it's not necessary
- if hub_shortname != 'pyevent':
- hub.abort()
- hubs.use_hub(hub_shortname)
+ hub = eventlet.hubs.get_hub()
+ hub_name = hub.__module__
+ hub.abort()
+ eventlet.hubs.use_hub(hub_name)
def assimilate_patched(name):
diff --git a/tests/stdlib/test_asyncore.py b/tests/stdlib/test_asyncore.py
index 85b4006..d8acdb1 100644
--- a/tests/stdlib/test_asyncore.py
+++ b/tests/stdlib/test_asyncore.py
@@ -50,16 +50,5 @@ try:
except NameError:
pass
-try:
- # temporarily disabling these tests in the python2.7/pyevent configuration
- from tests import using_pyevent
- import sys
- if using_pyevent(None) and sys.version_info >= (2, 7):
- TestAPI_UseSelect.test_handle_accept = lambda *a, **kw: None
- TestAPI_UseSelect.test_handle_close = lambda *a, **kw: None
- TestAPI_UseSelect.test_handle_read = lambda *a, **kw: None
-except NameError:
- pass
-
if __name__ == "__main__":
test_main()
diff --git a/tests/stdlib/test_ftplib.py b/tests/stdlib/test_ftplib.py
index be67420..6dc2d76 100644
--- a/tests/stdlib/test_ftplib.py
+++ b/tests/stdlib/test_ftplib.py
@@ -6,11 +6,5 @@ from eventlet.green import socket
patcher.inject('test.test_ftplib', globals())
-# this test only fails on python2.7/pyevent/--with-xunit; screw that
-try:
- TestTLS_FTPClass.test_data_connection = lambda *a, **kw: None
-except (AttributeError, NameError):
- pass
-
if __name__ == "__main__":
test_main()
diff --git a/tests/stdlib/test_socketserver.py b/tests/stdlib/test_socketserver.py
index 252a8c6..e5f5d55 100644
--- a/tests/stdlib/test_socketserver.py
+++ b/tests/stdlib/test_socketserver.py
@@ -20,15 +20,5 @@ patcher.inject(
('time', time),
('threading', threading))
-# only a problem with pyevent
-from eventlet import tests
-if tests.using_pyevent():
- try:
- SocketServerTest.test_ForkingUDPServer = lambda *a, **kw: None
- SocketServerTest.test_ForkingTCPServer = lambda *a, **kw: None
- SocketServerTest.test_ForkingUnixStreamServer = lambda *a, **kw: None
- except (NameError, AttributeError):
- pass
-
if __name__ == "__main__":
test_main()
diff --git a/tests/timer_test.py b/tests/timer_test.py
index 8e88eee..25446a4 100644
--- a/tests/timer_test.py
+++ b/tests/timer_test.py
@@ -24,9 +24,6 @@ class TestTimer(TestCase):
# t = timer.Timer(0, lambda: (called.append(True), hub.abort()))
# t.schedule()
# let's have a timer somewhere in the future; make sure abort() still works
- # (for pyevent, its dispatcher() does not exit if there is something scheduled)
- # XXX pyevent handles this, other hubs do not
- # hubs.get_hub().schedule_call_global(10000, lambda: (called.append(True), hub.abort()))
hubs.get_hub().schedule_call_global(0, lambda: (called.append(True), hub.abort()))
hub.default_sleep = lambda: 0.0
hub.switch()
diff --git a/tests/tpool_test.py b/tests/tpool_test.py
index 1a730dc..d66d867 100644
--- a/tests/tpool_test.py
+++ b/tests/tpool_test.py
@@ -47,7 +47,6 @@ class TestTpool(tests.LimitedTestCase):
tpool.killall()
super(TestTpool, self).tearDown()
- @tests.skip_with_pyevent
def test_wrap_tuple(self):
my_tuple = (1, 2)
prox = tpool.Proxy(my_tuple)
@@ -55,7 +54,6 @@ class TestTpool(tests.LimitedTestCase):
self.assertEqual(prox[1], 2)
self.assertEqual(len(my_tuple), 2)
- @tests.skip_with_pyevent
def test_wrap_string(self):
my_object = "whatever"
prox = tpool.Proxy(my_object)
@@ -63,7 +61,6 @@ class TestTpool(tests.LimitedTestCase):
self.assertEqual(len(my_object), len(prox))
self.assertEqual(my_object.join(['a', 'b']), prox.join(['a', 'b']))
- @tests.skip_with_pyevent
def test_wrap_uniterable(self):
prox = tpool.Proxy([])
@@ -76,7 +73,6 @@ class TestTpool(tests.LimitedTestCase):
self.assertRaises(IndexError, index)
self.assertRaises(TypeError, key)
- @tests.skip_with_pyevent
def test_wrap_dict(self):
my_object = {'a': 1}
prox = tpool.Proxy(my_object)
@@ -85,7 +81,6 @@ class TestTpool(tests.LimitedTestCase):
self.assertEqual(str(my_object), str(prox))
self.assertEqual(repr(my_object), repr(prox))
- @tests.skip_with_pyevent
def test_wrap_module_class(self):
prox = tpool.Proxy(re)
self.assertEqual(tpool.Proxy, type(prox))
@@ -93,7 +88,6 @@ class TestTpool(tests.LimitedTestCase):
self.assertEqual(exp.groups, 3)
assert repr(prox.compile)
- @tests.skip_with_pyevent
def test_wrap_eq(self):
prox = tpool.Proxy(re)
exp1 = prox.compile('.')
@@ -102,12 +96,10 @@ class TestTpool(tests.LimitedTestCase):
exp3 = prox.compile('/')
assert exp1 != exp3
- @tests.skip_with_pyevent
def test_wrap_ints(self):
p = tpool.Proxy(4)
assert p == 4
- @tests.skip_with_pyevent
def test_wrap_hash(self):
prox1 = tpool.Proxy('' + 'A')
prox2 = tpool.Proxy('A' + '')
@@ -118,7 +110,6 @@ class TestTpool(tests.LimitedTestCase):
proxList = tpool.Proxy([])
self.assertRaises(TypeError, hash, proxList)
- @tests.skip_with_pyevent
def test_wrap_nonzero(self):
prox = tpool.Proxy(re)
exp1 = prox.compile('.')
@@ -126,7 +117,6 @@ class TestTpool(tests.LimitedTestCase):
prox2 = tpool.Proxy([1, 2, 3])
assert bool(prox2)
- @tests.skip_with_pyevent
def test_multiple_wraps(self):
prox1 = tpool.Proxy(re)
prox2 = tpool.Proxy(re)
@@ -135,18 +125,15 @@ class TestTpool(tests.LimitedTestCase):
del x2
prox2.compile('.')
- @tests.skip_with_pyevent
def test_wrap_getitem(self):
prox = tpool.Proxy([0, 1, 2])
self.assertEqual(prox[0], 0)
- @tests.skip_with_pyevent
def test_wrap_setitem(self):
prox = tpool.Proxy([0, 1, 2])
prox[1] = 2
self.assertEqual(prox[1], 2)
- @tests.skip_with_pyevent
def test_wrap_iterator(self):
self.reset_timeout(2)
prox = tpool.Proxy(range(10))
@@ -155,7 +142,6 @@ class TestTpool(tests.LimitedTestCase):
result.append(i)
self.assertEqual(list(range(10)), result)
- @tests.skip_with_pyevent
def test_wrap_iterator2(self):
self.reset_timeout(5) # might take a while due to imprecise sleeping
@@ -184,7 +170,6 @@ class TestTpool(tests.LimitedTestCase):
assert counter[0] > 10, counter[0]
gt.kill()
- @tests.skip_with_pyevent
def test_raising_exceptions(self):
prox = tpool.Proxy(re)
@@ -196,7 +181,6 @@ class TestTpool(tests.LimitedTestCase):
prox = tpool.Proxy(tpool_test)
self.assertRaises(RuntimeError, prox.raise_exception)
- @tests.skip_with_pyevent
def test_variable_and_keyword_arguments_with_function_calls(self):
import optparse
parser = tpool.Proxy(optparse.OptionParser())
@@ -204,7 +188,6 @@ class TestTpool(tests.LimitedTestCase):
opts, args = parser.parse_args(["-nfoo"])
self.assertEqual(opts.n, 'foo')
- @tests.skip_with_pyevent
def test_contention(self):
from tests import tpool_test
prox = tpool.Proxy(tpool_test)
@@ -216,7 +199,6 @@ class TestTpool(tests.LimitedTestCase):
results = list(pile)
self.assertEqual(len(results), 3)
- @tests.skip_with_pyevent
def test_timeout(self):
blocking = eventlet.patcher.original('time')
eventlet.Timeout(0.1, eventlet.Timeout())
@@ -226,12 +208,10 @@ class TestTpool(tests.LimitedTestCase):
except eventlet.Timeout:
pass
- @tests.skip_with_pyevent
def test_killall(self):
tpool.killall()
tpool.setup()
- @tests.skip_with_pyevent
def test_killall_remaining_results(self):
semaphore = eventlet.Event()
@@ -247,7 +227,6 @@ class TestTpool(tests.LimitedTestCase):
tpool.killall()
gt.wait()
- @tests.skip_with_pyevent
def test_autowrap(self):
x = tpool.Proxy({'a': 1, 'b': 2}, autowrap=(int,))
assert isinstance(x.get('a'), tpool.Proxy)
@@ -258,7 +237,6 @@ class TestTpool(tests.LimitedTestCase):
assert isinstance(x.one, tpool.Proxy)
assert not isinstance(x.none, tpool.Proxy)
- @tests.skip_with_pyevent
def test_autowrap_names(self):
x = tpool.Proxy({'a': 1, 'b': 2}, autowrap_names=('get',))
assert isinstance(x.get('a'), tpool.Proxy)
@@ -268,7 +246,6 @@ class TestTpool(tests.LimitedTestCase):
assert isinstance(x.one, tpool.Proxy)
assert not isinstance(x.two, tpool.Proxy)
- @tests.skip_with_pyevent
def test_autowrap_both(self):
from tests import tpool_test
x = tpool.Proxy(tpool_test, autowrap=(int,), autowrap_names=('one',))
@@ -276,7 +253,6 @@ class TestTpool(tests.LimitedTestCase):
# violating the abstraction to check that we didn't double-wrap
assert not isinstance(x._obj, tpool.Proxy)
- @tests.skip_with_pyevent
def test_callable(self):
def wrapped(arg):
return arg
@@ -287,7 +263,6 @@ class TestTpool(tests.LimitedTestCase):
assert isinstance(x(4), tpool.Proxy)
self.assertEqual("4", str(x(4)))
- @tests.skip_with_pyevent
def test_callable_iterator(self):
def wrapped(arg):
yield arg
@@ -298,13 +273,11 @@ class TestTpool(tests.LimitedTestCase):
for r in x(3):
self.assertEqual(3, r)
- @tests.skip_with_pyevent
def test_eventlet_timeout(self):
def raise_timeout():
raise eventlet.Timeout()
self.assertRaises(eventlet.Timeout, tpool.execute, raise_timeout)
- @tests.skip_with_pyevent
def test_tpool_set_num_threads(self):
tpool.set_num_threads(5)
self.assertEqual(5, tpool._nthreads)
@@ -313,7 +286,6 @@ class TestTpool(tests.LimitedTestCase):
class TpoolLongTests(tests.LimitedTestCase):
TEST_TIMEOUT = 60
- @tests.skip_with_pyevent
def test_a_buncha_stuff(self):
assert_ = self.assert_
@@ -342,7 +314,6 @@ class TpoolLongTests(tests.LimitedTestCase):
self.assertEqual(len(results), cnt)
tpool.killall()
- @tests.skip_with_pyevent
def test_leakage_from_tracebacks(self):
tpool.execute(noop) # get it started
gc.collect()
diff --git a/tests/wsgi_test.py b/tests/wsgi_test.py
index f2b88c2..298f694 100644
--- a/tests/wsgi_test.py
+++ b/tests/wsgi_test.py
@@ -1924,7 +1924,6 @@ class IterableAlreadyHandledTest(_TestBase):
class ProxiedIterableAlreadyHandledTest(IterableAlreadyHandledTest):
# same thing as the previous test but ensuring that it works with tpooled
# results as well as regular ones
- @tests.skip_with_pyevent
def get_app(self):
return tpool.Proxy(super(ProxiedIterableAlreadyHandledTest, self).get_app())
diff --git a/tests/zmq_test.py b/tests/zmq_test.py
index 601878f..634b785 100644
--- a/tests/zmq_test.py
+++ b/tests/zmq_test.py
@@ -16,7 +16,7 @@ def zmq_supported(_):
import zmq
except ImportError:
return False
- return not tests.using_pyevent(_)
+ return True
class TestUpstreamDownStream(tests.LimitedTestCase):