summaryrefslogtreecommitdiff
path: root/tests/patcher_test_tpool_util.py
blob: cb4ee8c277d70c172ed759efa7ab7dda798adabb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()