summaryrefslogtreecommitdiff
path: root/tests/patcher_test_monkey_threading.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/patcher_test_monkey_threading.py')
-rw-r--r--tests/patcher_test_monkey_threading.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/patcher_test_monkey_threading.py b/tests/patcher_test_monkey_threading.py
new file mode 100644
index 0000000..9de0210
--- /dev/null
+++ b/tests/patcher_test_monkey_threading.py
@@ -0,0 +1,25 @@
+# no standard tests in this file, ignore
+__test__ = False
+
+import eventlet
+from eventlet import tpool
+
+
+def check_tpool_patched():
+ tickcount = [0]
+
+ def tick():
+ from eventlet.support import six
+ 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()