summaryrefslogtreecommitdiff
path: root/tests/isolated/env_tpool_zero.py
blob: 3c70b75f33dcb45b5ff1b8b2e84090018a537f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
__test__ = False

if __name__ == '__main__':
    import warnings
    from eventlet import tpool
    g = [False]

    def do():
        g[0] = True

    with warnings.catch_warnings(record=True) as ws:
        warnings.simplefilter('always', category=RuntimeWarning)

        tpool.execute(do)

        msgs = [str(w) for w in ws]
        assert len(ws) == 1, msgs
        msg = str(ws[0].message)
        assert 'Zero threads in tpool' in msg
        assert 'EVENTLET_THREADPOOL_SIZE' in msg

    assert g[0]
    print('pass')