| 1 |
import tests |
| 2 |
|
| 3 |
|
| 4 |
def test_hub_selects(): |
| 5 |
code = 'from eventlet import hubs\nprint(hubs.get_hub())' |
| 6 |
output = tests.run_python( |
| 7 |
path=None, |
| 8 |
env={'EVENTLET_HUB': 'selects'}, |
| 9 |
args=['-c', code], |
| 10 |
) |
| 11 |
assert output.count(b'\n') == 1 |
| 12 |
assert b'eventlet.hubs.selects.Hub' in output |
| 13 |
|
| 14 |
|
| 15 |
def test_tpool_dns(): |
| 16 |
code = '''\ |
| 17 |
from eventlet.green import socket |
| 18 |
socket.gethostbyname('localhost') |
| 19 |
socket.getaddrinfo('localhost', 80) |
| 20 |
print('pass') |
| 21 |
''' |
| 22 |
tests.run_python( |
| 23 |
path=None, |
| 24 |
env={'EVENTLET_TPOOL_DNS': 'yes'}, |
| 25 |
args=['-c', code], |
| 26 |
expect_pass=True, |
| 27 |
) |
| 28 |
|
| 29 |
|
| 30 |
def test_tpool_size(): |
| 31 |
expected = '40' |
| 32 |
normal = '20' |
| 33 |
tests.run_isolated( |
| 34 |
path='env_tpool_size.py', |
| 35 |
env={'EVENTLET_THREADPOOL_SIZE': expected}, |
| 36 |
args=[expected, normal], |
| 37 |
) |
| 38 |
|
| 39 |
|
| 40 |
def test_tpool_negative(): |
| 41 |
tests.run_isolated('env_tpool_negative.py', env={'EVENTLET_THREADPOOL_SIZE': '-1'}) |
| 42 |
|
| 43 |
|
| 44 |
def test_tpool_zero(): |
| 45 |
tests.run_isolated('env_tpool_zero.py', env={'EVENTLET_THREADPOOL_SIZE': '0'}) |