Skip to content

Commit 589d2f4

Browse files
authored
test(wsgi-servers): add CherryPy's Cheroot to WSGI server tests (#2479)
* test(wsgi-servers): add CherryPy's Cheroot to WSGI server tests * chore(typing): add cheroot to mypy exceptions See also: cherrypy/cheroot#384. * chore(mypy_tests): install cheroot, remove from mypy overrides
1 parent f6b77a8 commit 589d2f4

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

tests/test_wsgi_servers.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@
2424
_SHUTDOWN_TIMEOUT = 20
2525

2626

27+
def _cheroot_args(host, port):
28+
"""CherryPy's Cheroot"""
29+
try:
30+
import cheroot # noqa: F401
31+
except ImportError:
32+
pytest.skip('cheroot not installed')
33+
34+
args = (
35+
sys.executable,
36+
'-m',
37+
'cheroot',
38+
'--bind',
39+
'{}:{}'.format(host, port),
40+
# NOTE(vytas): In case a worker hangs for an unexpectedly long time
41+
# while reading or processing request (the default value is 30).
42+
'--timeout',
43+
str(_REQUEST_TIMEOUT),
44+
)
45+
return args + ('_wsgi_test_app:app',)
46+
47+
2748
def _gunicorn_args(host, port, extra_opts=()):
2849
"""Gunicorn"""
2950
try:
@@ -119,14 +140,17 @@ def _waitress_args(host, port):
119140
)
120141

121142

122-
@pytest.fixture(params=['gunicorn', 'meinheld', 'uvicorn', 'uwsgi', 'waitress'])
143+
@pytest.fixture(
144+
params=['cheroot', 'gunicorn', 'meinheld', 'uvicorn', 'uwsgi', 'waitress']
145+
)
123146
def wsgi_server(request):
124147
return request.param
125148

126149

127150
@pytest.fixture
128151
def server_args(wsgi_server):
129152
servers = {
153+
'cheroot': _cheroot_args,
130154
'gunicorn': _gunicorn_args,
131155
'meinheld': _meinheld_args,
132156
'uvicorn': _uvicorn_args,

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ commands = python {toxinidir}/tools/clean.py "{toxinidir}/falcon"
121121
[testenv:mypy_tests]
122122
deps = {[testenv]deps}
123123
mypy
124+
cheroot
124125
types-requests
125126
types-PyYAML
126127
types-ujson
@@ -195,6 +196,7 @@ commands = {[with-cython]commands}
195196
[testenv:wsgi_servers]
196197
setenv = {[with-cython]setenv}
197198
deps = {[with-cython]deps}
199+
cheroot
198200
gunicorn
199201
uwsgi
200202
waitress

0 commit comments

Comments
 (0)