summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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.py12
-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
15 files changed, 15 insertions, 106 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index 3608b63..d678778 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -98,16 +98,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 6dbacdc..537d3c6 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 dae1a66..944c81f 100644
--- a/tests/greenio_test.py
+++ b/tests/greenio_test.py
@@ -515,7 +515,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)
@@ -537,7 +536,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):
@@ -856,7 +854,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 65ba0a9..9b97cb0 100644
--- a/tests/hub_test.py
+++ b/tests/hub_test.py
@@ -1,9 +1,7 @@
-from __future__ import with_statement
import sys
import time
import tests
-from tests import skip_with_pyevent, skip_if_no_itimer, skip_unless
from tests.patcher_test import ProcessBase
import eventlet
from eventlet import hubs
@@ -20,7 +18,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()
@@ -34,7 +31,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()
@@ -51,7 +47,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
@@ -149,7 +144,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()
@@ -218,7 +213,6 @@ class TestHubSelection(tests.LimitedTestCase):
class TestHubBlockingDetector(tests.LimitedTestCase):
TEST_TIMEOUT = 10
- @skip_with_pyevent
def test_block_detect(self):
def look_im_blocking():
import time
@@ -229,8 +223,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
@@ -295,7 +288,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 578de4e..dc7a780 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:
@@ -39,7 +36,7 @@ def mysql_requirement(_f):
class TestMySQLdb(tests.LimitedTestCase):
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)
@@ -60,7 +57,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:
@@ -227,6 +224,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 ff59400..116c225 100644
--- a/tests/patcher_test.py
+++ b/tests/patcher_test.py
@@ -229,7 +229,6 @@ def test_monkey_patch_threading():
class Tpool(ProcessBase):
TEST_TIMEOUT = 3
- @tests.skip_with_pyevent
def test_simple(self):
new_mod = """
import eventlet
@@ -247,7 +246,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)
@@ -260,7 +258,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 3d05d1e..23df5b2 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 ea889aa..23f35f3 100644
--- a/tests/stdlib/test_asyncore.py
+++ b/tests/stdlib/test_asyncore.py
@@ -49,16 +49,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 78e3437..e2bcb2f 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 d680154..01f56f0 100644
--- a/tests/wsgi_test.py
+++ b/tests/wsgi_test.py
@@ -1680,7 +1680,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):