File: env_tpool_zero.py

package info (click to toggle)
python-eventlet 0.26.1-7%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,916 kB
  • sloc: python: 24,898; makefile: 98
file content (23 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (6)
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')