summaryrefslogtreecommitdiff
path: root/tests/patcher_test_tpool_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/patcher_test_tpool_util.py')
-rw-r--r--tests/patcher_test_tpool_util.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/patcher_test_tpool_util.py b/tests/patcher_test_tpool_util.py
new file mode 100644
index 0000000..cb4ee8c
--- /dev/null
+++ b/tests/patcher_test_tpool_util.py
@@ -0,0 +1,27 @@
+# no standard tests in this file, ignore
+__test__ = False
+
+
+def check_tpool_patched():
+ import time
+
+ import eventlet
+ from eventlet import tpool
+ from eventlet.support import six
+
+ tickcount = [0]
+
+ def tick():
+ for i in six.moves.range(1000):
+ tickcount[0] += 1
+ eventlet.sleep()
+
+ def do_sleep():
+ tpool.execute(time.sleep, 0.5)
+
+ eventlet.spawn(tick)
+ w1 = eventlet.spawn(do_sleep)
+ w1.wait()
+ print(tickcount[0])
+ assert tickcount[0] > 900
+ tpool.killall()