tests/isolated/patcher_threadpoolexecutor.py
raw| 1 | # Issue #508: test ThreadPoolExecutor with monkey-patching |
| 2 | __test__ = False |
| 3 | |
| 4 | if __name__ == '__main__': |
| 5 | import eventlet |
| 6 | eventlet.monkey_patch() |
| 7 | |
| 8 | import sys |
| 9 | |
| 10 | # Futures is only included in 3.2 or later |
| 11 | from concurrent import futures |
| 12 | |
| 13 | with futures.ThreadPoolExecutor(max_workers=1) as executor: |
| 14 | future = executor.submit(pow, 2, 3) |
| 15 | res = future.result() |
| 16 | assert res == 8, '2^3 should be 8, not %s' % res |
| 17 | print('pass') |