Renamed libevent hub to pyevent.
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,6 +1,7 @@
|
|||||||
0.9.3
|
0.9.3
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
* Renamed libevent hub to pyevent.
|
||||||
* Renamed coros.event to coros.Event
|
* Renamed coros.event to coros.Event
|
||||||
* Removed previously-deprecated features tcp_server, GreenSSL, erpc, and trap_errors.
|
* Removed previously-deprecated features tcp_server, GreenSSL, erpc, and trap_errors.
|
||||||
* Removed saranwrap as an option for making db connections nonblocking in db_pool.
|
* Removed saranwrap as an option for making db connections nonblocking in db_pool.
|
||||||
|
@@ -66,7 +66,7 @@ If you wish to run tests against a particular Twisted reactor, use ``--reactor=R
|
|||||||
|
|
||||||
* poll
|
* poll
|
||||||
* selects
|
* selects
|
||||||
* libevent (requires pyevent)
|
* pyevent (requires pyevent installed on your system)
|
||||||
|
|
||||||
Writing Tests
|
Writing Tests
|
||||||
-------------
|
-------------
|
||||||
|
@@ -320,10 +320,10 @@ def get_default_hub():
|
|||||||
then poll, then select.
|
then poll, then select.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# libevent hub disabled for now because it is not thread-safe
|
# pyevent hub disabled for now because it is not thread-safe
|
||||||
#try:
|
#try:
|
||||||
# import eventlet.hubs.libevent
|
# import eventlet.hubs.pyevent
|
||||||
# return eventlet.hubs.libevent
|
# return eventlet.hubs.pyevent
|
||||||
#except:
|
#except:
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
@@ -71,12 +71,12 @@ def requires_twisted(func):
|
|||||||
return skip_unless(requirement)(func)
|
return skip_unless(requirement)(func)
|
||||||
|
|
||||||
|
|
||||||
def skip_with_libevent(func):
|
def skip_with_pyevent(func):
|
||||||
""" Decorator that skips a test if we're using the libevent hub."""
|
""" Decorator that skips a test if we're using the pyevent hub."""
|
||||||
def using_libevent(_f):
|
def using_pyevent(_f):
|
||||||
from eventlet.api import get_hub
|
from eventlet.api import get_hub
|
||||||
return 'libevent' in type(get_hub()).__module__
|
return 'pyevent' in type(get_hub()).__module__
|
||||||
return skip_if(using_libevent)(func)
|
return skip_if(using_pyevent)(func)
|
||||||
|
|
||||||
|
|
||||||
def skip_on_windows(func):
|
def skip_on_windows(func):
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from tests import skipped, LimitedTestCase, skip_with_libevent, TestIsTakingTooLong
|
from tests import skipped, LimitedTestCase, skip_with_pyevent, TestIsTakingTooLong
|
||||||
from unittest import main
|
from unittest import main
|
||||||
from eventlet import api, util, coros, proc, greenio
|
from eventlet import api, util, coros, proc, greenio
|
||||||
from eventlet.green.socket import GreenSSLObject
|
from eventlet.green.socket import GreenSSLObject
|
||||||
@@ -186,7 +186,7 @@ class TestGreenIo(LimitedTestCase):
|
|||||||
for bytes in (1000, 10000, 100000, 1000000):
|
for bytes in (1000, 10000, 100000, 1000000):
|
||||||
test_sendall_impl(bytes)
|
test_sendall_impl(bytes)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_multiple_readers(self):
|
def test_multiple_readers(self):
|
||||||
recvsize = 2 * min_buf_size()
|
recvsize = 2 * min_buf_size()
|
||||||
sendsize = 10 * recvsize
|
sendsize = 10 * recvsize
|
||||||
|
@@ -34,8 +34,8 @@ class TestTimer(TestCase):
|
|||||||
#t = timer.Timer(0, lambda: (called.append(True), hub.abort()))
|
#t = timer.Timer(0, lambda: (called.append(True), hub.abort()))
|
||||||
#t.schedule()
|
#t.schedule()
|
||||||
# let's have a timer somewhere in the future; make sure abort() still works
|
# let's have a timer somewhere in the future; make sure abort() still works
|
||||||
# (for libevent, its dispatcher() does not exit if there is something scheduled)
|
# (for pyevent, its dispatcher() does not exit if there is something scheduled)
|
||||||
# XXX libevent handles this, other hubs do not
|
# XXX pyevent handles this, other hubs do not
|
||||||
#api.get_hub().schedule_call_global(10000, lambda: (called.append(True), hub.abort()))
|
#api.get_hub().schedule_call_global(10000, lambda: (called.append(True), hub.abort()))
|
||||||
api.get_hub().schedule_call_global(0, lambda: (called.append(True), hub.abort()))
|
api.get_hub().schedule_call_global(0, lambda: (called.append(True), hub.abort()))
|
||||||
hub.default_sleep = lambda: 0.0
|
hub.default_sleep = lambda: 0.0
|
||||||
|
@@ -17,7 +17,7 @@ import random
|
|||||||
from sys import stdout
|
from sys import stdout
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
from tests import skipped, skip_with_libevent
|
from tests import skipped, skip_with_pyevent
|
||||||
from unittest import TestCase, main
|
from unittest import TestCase, main
|
||||||
|
|
||||||
from eventlet import coros, api, tpool
|
from eventlet import coros, api, tpool
|
||||||
@@ -70,7 +70,7 @@ class TestTpool(TestCase):
|
|||||||
tpool.QUIET = False
|
tpool.QUIET = False
|
||||||
tpool.killall()
|
tpool.killall()
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_a_buncha_stuff(self):
|
def test_a_buncha_stuff(self):
|
||||||
pool = coros.CoroutinePool(max_size=10)
|
pool = coros.CoroutinePool(max_size=10)
|
||||||
waiters = []
|
waiters = []
|
||||||
@@ -79,7 +79,7 @@ class TestTpool(TestCase):
|
|||||||
for waiter in waiters:
|
for waiter in waiters:
|
||||||
waiter.wait()
|
waiter.wait()
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_tuple(self):
|
def test_wrap_tuple(self):
|
||||||
my_tuple = (1, 2)
|
my_tuple = (1, 2)
|
||||||
prox = tpool.Proxy(my_tuple)
|
prox = tpool.Proxy(my_tuple)
|
||||||
@@ -87,7 +87,7 @@ class TestTpool(TestCase):
|
|||||||
self.assertEqual(prox[1], 2)
|
self.assertEqual(prox[1], 2)
|
||||||
self.assertEqual(len(my_tuple), 2)
|
self.assertEqual(len(my_tuple), 2)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_string(self):
|
def test_wrap_string(self):
|
||||||
my_object = "whatever"
|
my_object = "whatever"
|
||||||
prox = tpool.Proxy(my_object)
|
prox = tpool.Proxy(my_object)
|
||||||
@@ -95,7 +95,7 @@ class TestTpool(TestCase):
|
|||||||
self.assertEqual(len(my_object), len(prox))
|
self.assertEqual(len(my_object), len(prox))
|
||||||
self.assertEqual(my_object.join(['a', 'b']), prox.join(['a', 'b']))
|
self.assertEqual(my_object.join(['a', 'b']), prox.join(['a', 'b']))
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_uniterable(self):
|
def test_wrap_uniterable(self):
|
||||||
# here we're treating the exception as just a normal class
|
# here we're treating the exception as just a normal class
|
||||||
prox = tpool.Proxy(FloatingPointError())
|
prox = tpool.Proxy(FloatingPointError())
|
||||||
@@ -107,7 +107,7 @@ class TestTpool(TestCase):
|
|||||||
self.assertRaises(IndexError, index)
|
self.assertRaises(IndexError, index)
|
||||||
self.assertRaises(TypeError, key)
|
self.assertRaises(TypeError, key)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_dict(self):
|
def test_wrap_dict(self):
|
||||||
my_object = {'a':1}
|
my_object = {'a':1}
|
||||||
prox = tpool.Proxy(my_object)
|
prox = tpool.Proxy(my_object)
|
||||||
@@ -117,7 +117,7 @@ class TestTpool(TestCase):
|
|||||||
self.assertEqual(repr(my_object), repr(prox))
|
self.assertEqual(repr(my_object), repr(prox))
|
||||||
self.assertEqual(`my_object`, `prox`)
|
self.assertEqual(`my_object`, `prox`)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_module_class(self):
|
def test_wrap_module_class(self):
|
||||||
prox = tpool.Proxy(re)
|
prox = tpool.Proxy(re)
|
||||||
self.assertEqual(tpool.Proxy, type(prox))
|
self.assertEqual(tpool.Proxy, type(prox))
|
||||||
@@ -125,7 +125,7 @@ class TestTpool(TestCase):
|
|||||||
self.assertEqual(exp.flags, 0)
|
self.assertEqual(exp.flags, 0)
|
||||||
self.assert_(repr(prox.compile))
|
self.assert_(repr(prox.compile))
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_eq(self):
|
def test_wrap_eq(self):
|
||||||
prox = tpool.Proxy(re)
|
prox = tpool.Proxy(re)
|
||||||
exp1 = prox.compile('.')
|
exp1 = prox.compile('.')
|
||||||
@@ -134,7 +134,7 @@ class TestTpool(TestCase):
|
|||||||
exp3 = prox.compile('/')
|
exp3 = prox.compile('/')
|
||||||
self.assert_(exp1 != exp3)
|
self.assert_(exp1 != exp3)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_nonzero(self):
|
def test_wrap_nonzero(self):
|
||||||
prox = tpool.Proxy(re)
|
prox = tpool.Proxy(re)
|
||||||
exp1 = prox.compile('.')
|
exp1 = prox.compile('.')
|
||||||
@@ -142,7 +142,7 @@ class TestTpool(TestCase):
|
|||||||
prox2 = tpool.Proxy([1, 2, 3])
|
prox2 = tpool.Proxy([1, 2, 3])
|
||||||
self.assert_(bool(prox2))
|
self.assert_(bool(prox2))
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_multiple_wraps(self):
|
def test_multiple_wraps(self):
|
||||||
prox1 = tpool.Proxy(re)
|
prox1 = tpool.Proxy(re)
|
||||||
prox2 = tpool.Proxy(re)
|
prox2 = tpool.Proxy(re)
|
||||||
@@ -151,18 +151,18 @@ class TestTpool(TestCase):
|
|||||||
del x2
|
del x2
|
||||||
x3 = prox2.compile('.')
|
x3 = prox2.compile('.')
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_getitem(self):
|
def test_wrap_getitem(self):
|
||||||
prox = tpool.Proxy([0,1,2])
|
prox = tpool.Proxy([0,1,2])
|
||||||
self.assertEqual(prox[0], 0)
|
self.assertEqual(prox[0], 0)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_wrap_setitem(self):
|
def test_wrap_setitem(self):
|
||||||
prox = tpool.Proxy([0,1,2])
|
prox = tpool.Proxy([0,1,2])
|
||||||
prox[1] = 2
|
prox[1] = 2
|
||||||
self.assertEqual(prox[1], 2)
|
self.assertEqual(prox[1], 2)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_raising_exceptions(self):
|
def test_raising_exceptions(self):
|
||||||
prox = tpool.Proxy(re)
|
prox = tpool.Proxy(re)
|
||||||
def nofunc():
|
def nofunc():
|
||||||
@@ -172,7 +172,7 @@ class TestTpool(TestCase):
|
|||||||
def assertLessThan(self, a, b):
|
def assertLessThan(self, a, b):
|
||||||
self.assert_(a < b, "%s is not less than %s" % (a, b))
|
self.assert_(a < b, "%s is not less than %s" % (a, b))
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_variable_and_keyword_arguments_with_function_calls(self):
|
def test_variable_and_keyword_arguments_with_function_calls(self):
|
||||||
import optparse
|
import optparse
|
||||||
parser = tpool.Proxy(optparse.OptionParser())
|
parser = tpool.Proxy(optparse.OptionParser())
|
||||||
@@ -180,7 +180,7 @@ class TestTpool(TestCase):
|
|||||||
opts,args = parser.parse_args(["-nfoo"])
|
opts,args = parser.parse_args(["-nfoo"])
|
||||||
self.assertEqual(opts.n, 'foo')
|
self.assertEqual(opts.n, 'foo')
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_contention(self):
|
def test_contention(self):
|
||||||
from tests import tpool_test
|
from tests import tpool_test
|
||||||
prox = tpool.Proxy(tpool_test)
|
prox = tpool.Proxy(tpool_test)
|
||||||
@@ -193,14 +193,14 @@ class TestTpool(TestCase):
|
|||||||
for waiter in waiters:
|
for waiter in waiters:
|
||||||
waiter.wait()
|
waiter.wait()
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_timeout(self):
|
def test_timeout(self):
|
||||||
import time
|
import time
|
||||||
api.exc_after(0.1, api.TimeoutError())
|
api.exc_after(0.1, api.TimeoutError())
|
||||||
self.assertRaises(api.TimeoutError,
|
self.assertRaises(api.TimeoutError,
|
||||||
tpool.execute, time.sleep, 0.3)
|
tpool.execute, time.sleep, 0.3)
|
||||||
|
|
||||||
@skip_with_libevent
|
@skip_with_pyevent
|
||||||
def test_killall(self):
|
def test_killall(self):
|
||||||
tpool.killall()
|
tpool.killall()
|
||||||
tpool.setup()
|
tpool.setup()
|
||||||
|
Reference in New Issue
Block a user