File: env_tpool_zero.py

package info (click to toggle)
python-eventlet 0.19.0-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,120 kB
  • ctags: 3,551
  • sloc: python: 18,723; sh: 196; makefile: 102
file content (22 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
__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')

        tpool.execute(do)

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

    assert g[0]
    print('pass')