forked from falconry/falcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
521 lines (440 loc) · 14.9 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
[tox]
# --------------------------------------------------------------------
#
# NOTE(kgriffs,vytas): Python 3.8 or 3.10 are required when checking
# combined coverage. To check coverage:
#
# $ tox
#
# You can then drill down into coverage details by opening the HTML
# report at ".coverage_html/index.html".
#
# --------------------------------------------------------------------
envlist = cleanup,
blue,
pep8,
mypy,
mypy_tests,
mintest,
pytest,
pytest_sans_msgpack,
coverage,
towncrier
[testenv]
# NOTE(vytas): Other Falcon-specific environment variables for automatic
# wrapping of coroutines are set in tests/conftest.py.
setenv =
PIP_CONFIG_FILE={toxinidir}/pip.conf
PYTHONASYNCIODEBUG=1
FALCON_DISABLE_CYTHON=Y
deps = -r{toxinidir}/requirements/tests
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
pytest tests []
# --------------------------------------------------------------------
# Miscellaneous tasks
# --------------------------------------------------------------------
[testenv:cleanup]
deps = {[testenv]deps}
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
coverage erase
[testenv:coverage]
deps = {[testenv]deps}
commands = coverage combine
coverage html -d {toxinidir}/.coverage_html
coverage report --fail-under 100
# --------------------------------------------------------------------
# ASGI servers
# --------------------------------------------------------------------
[testenv:daphne]
deps = {[testenv]deps}
daphne
[testenv:hypercorn]
# TODO(vytas): Unpin Hypercorn once the buggy versions are yanked upstream.
deps = {[testenv]deps}
hypercorn != 0.14.0, != 0.14.1
# --------------------------------------------------------------------
# Test without optional packages
# --------------------------------------------------------------------
[testenv:no_optional_packages]
deps = {[testenv]deps}
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
pip uninstall --yes python-rapidjson daphne orjson
pytest tests []
# --------------------------------------------------------------------
# Coverage
# --------------------------------------------------------------------
[with-coverage]
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
coverage run -m pytest tests []
[testenv:mintest]
setenv =
PIP_CONFIG_FILE={toxinidir}/pip.conf
PYTHONASYNCIODEBUG=1
FALCON_DISABLE_CYTHON=Y
deps = -r{toxinidir}/requirements/mintest
commands = coverage run -m pytest tests --ignore=tests/asgi []
[testenv:pytest]
deps = {[testenv]deps}
pytest-randomly
jsonschema
commands = coverage run -m pytest tests []
[testenv:pytest_sans_msgpack]
deps = {[testenv]deps}
commands = pip uninstall --yes msgpack
coverage run -m pytest tests -k "test_ws and test_msgpack_missing"
[testenv:py310]
basepython = python3.10
deps = {[testenv]deps}
pytest-randomly
jsonschema
commands = {[with-coverage]commands}
[testenv:py310_sans_msgpack]
basepython = python3.10
deps = {[testenv]deps}
commands = pip uninstall --yes msgpack
coverage run -m pytest tests -k "test_ws and test_msgpack_missing"
[testenv:py310_nocover]
basepython = python3.10
deps = {[testenv]deps}
pytest-randomly
jsonschema
commands = pytest tests []
# --------------------------------------------------------------------
# Additional test suite environments
# --------------------------------------------------------------------
[testenv:pypy3]
basepython = pypy3
# --------------------------------------------------------------------
# Debugging
# --------------------------------------------------------------------
[with-debug-tools]
deps = -r{toxinidir}/requirements/tests
pdbpp
[testenv:py3_debug]
basepython = python3.10
deps = {[with-debug-tools]deps}
uvicorn
jsonschema
# --------------------------------------------------------------------
# mypy
# --------------------------------------------------------------------
[testenv:mypy]
skipsdist = True
skip_install = True
deps = mypy
types-jsonschema
commands = python {toxinidir}/tools/clean.py "{toxinidir}/falcon"
mypy falcon
[testenv:mypy_tests]
deps = {[testenv]deps}
mypy
types-requests
types-PyYAML
types-ujson
types-waitress
types-aiofiles
types-jsonschema
commands = python "{toxinidir}/tools/clean.py" "{toxinidir}/falcon"
mypy e2e-tests/server
mypy tests
# --------------------------------------------------------------------
# Cython
# --------------------------------------------------------------------
[with-cython]
deps = -r{toxinidir}/requirements/tests
Cython
# NOTE(vytas): By using --no-build-isolation, we need to manage build
# deps ourselves, and on CPython 3.12, it seems even setuptools
# (our PEP 517 backend of choice) is not guaranteed to be there.
setuptools
wheel
setenv =
PIP_CONFIG_FILE={toxinidir}/pip.conf
FALCON_DISABLE_CYTHON=
FALCON_ASGI_WRAP_NON_COROUTINES=Y
FALCON_TESTING_SESSION=Y
PYTHONASYNCIODEBUG=1
install_command = python -m pip install --no-build-isolation {opts} {packages}
commands = pytest tests []
[testenv:py37_cython]
basepython = python3.7
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
[testenv:py38_cython]
basepython = python3.8
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
[testenv:py39_cython]
basepython = python3.9
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
[testenv:py310_cython]
basepython = python3.10
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
[testenv:py311_cython]
basepython = python3.11
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
[testenv:py312_cython]
basepython = python3.12
install_command = {[with-cython]install_command}
deps = {[with-cython]deps}
setenv = {[with-cython]setenv}
commands = {[with-cython]commands}
# --------------------------------------------------------------------
# WSGI servers (Cythonized Falcon)
# --------------------------------------------------------------------
[testenv:wsgi_servers]
install_command = {[with-cython]install_command}
setenv = {[with-cython]setenv}
deps = {[with-cython]deps}
gunicorn
# NOTE(caselit): meinheld requires greenlet<0.5 that's not compatible with py3.10
meinheld
uwsgi
waitress
commands = pytest -v tests/test_wsgi_servers.py
# --------------------------------------------------------------------
# Smoke testing with a sample app
# --------------------------------------------------------------------
[smoke-test]
# NOTE(vytas): Work around pprofile's reliance on the removed use_2to3 option:
# https://github.com/vpelletier/pprofile/issues/41
commands = pip install "setuptools < 58.0"
pip install -r {toxinidir}/requirements/bench
python -c "import falcon.asgi; falcon.asgi.App()"
falcon-bench -t 1 -b falcon-ext
[testenv:py38_smoke]
# NOTE(caselit): vmprof requires python 3.8 https://github.com/vmprof/vmprof-python/issues/240
basepython = python3.8
deps =
commands = {[smoke-test]commands}
[testenv:py38_smoke_cython]
# NOTE(caselit): vmprof requires python 3.8 https://github.com/vmprof/vmprof-python/issues/240
basepython = python3.8
deps = cython
setenv = {[with-cython]setenv}
commands = {[smoke-test]commands}
# --------------------------------------------------------------------
# Lint
# --------------------------------------------------------------------
[testenv:pep8]
deps = flake8
flake8-quotes
flake8-import-order
commands = flake8 []
[testenv:blue]
deps = blue>=0.9.0
commands = blue --check . []
[testenv:reformat]
deps = blue>=0.9.0
commands = blue . []
[testenv:pep8-docstrings]
deps = flake8
flake8-docstrings
basepython = python3.10
commands = flake8 \
--docstring-convention=pep257 \
--exclude=.ecosystem,.eggs,.git,.tox,.venv,build,dist,docs,examples,tests,falcon/vendor,falcon/bench/nuts \
--select=D205,D212,D400,D401,D403,D404 \
[]
[testenv:pep8-examples]
deps = flake8
flake8-quotes
flake8-import-order
basepython = python3.10
commands = flake8 examples \
--max-complexity=12 \
--ignore=F403,W503,W504 \
--max-line-length=99 \
--import-order-style=google \
--application-import-names=asgilook,look \
[]
# --------------------------------------------------------------------
# For viewing environ dicts generated by various WSGI servers
# --------------------------------------------------------------------
[testenv:py310_dump_gunicorn]
basepython = python3.10
deps = gunicorn
commands = gunicorn -b localhost:8000 tests.dump_wsgi
[testenv:py310_dump_waitress]
basepython = python3.10
deps = waitress
commands = waitress-serve --listen=localhost:8000 tests.dump_wsgi:application
[testenv:py310_dump_wsgiref]
basepython = python3.10
commands = python tests/dump_wsgi.py
# --------------------------------------------------------------------
# Benchmarking
# --------------------------------------------------------------------
[testenv:py310_bench]
basepython = python3.10
deps = -r{toxinidir}/requirements/bench
commands = falcon-bench []
[testenv:py310_bench_cython]
basepython = python3.10
deps = -r{toxinidir}/requirements/bench
cython
commands = falcon-bench []
[testenv:py38_bench]
basepython = python3.8
deps = -r{toxinidir}/requirements/bench
commands = falcon-bench []
[testenv:py38_bench_cython]
basepython = python3.8
deps = -r{toxinidir}/requirements/bench
cython
commands = falcon-bench []
[testenv:pypy_bench]
basepython = pypy
deps = -r{toxinidir}/requirements/bench
commands = falcon-bench []
[testenv:pypy3_bench]
basepython = pypy3
deps = -r{toxinidir}/requirements/bench
commands = falcon-bench []
# --------------------------------------------------------------------
# Check for new versions of vendored packages
# --------------------------------------------------------------------
[testenv:check_vendored]
basepython = python3.10
allowlist_externals = {toxinidir}/tools/check-vendored.sh
deps =
commands = {toxinidir}/tools/check-vendored.sh
# --------------------------------------------------------------------
# Package sanity check with twine
# --------------------------------------------------------------------
[testenv:twine_check]
basepython = python3.10
skipsdist = True
deps = setuptools
twine
wheel
commands =
python {toxinidir}/setup.py bdist_wheel sdist
twine check {toxinidir}/dist/*
# --------------------------------------------------------------------
# Documentation
# --------------------------------------------------------------------
[testenv:docs]
basepython = python3.10
deps = -r{toxinidir}/requirements/docs
commands =
sphinx-build -j auto -W -E -b html docs docs/_build/html []
# NOTE(vytas): importlib-resources is wreaking havoc by backporting future
# removals from 3.13 (3.11 being the current stable at the time of writing);
# hence we pin it manually here.
[testenv:towncrier]
deps = -r{toxinidir}/requirements/docs
importlib-resources < 6.0
toml
towncrier
commands =
python "{toxinidir}/tools/towncrier_draft.py" --dry-run
[testenv:changelog_release]
deps = -r{toxinidir}/requirements/docs
toml
towncrier
commands =
python "{toxinidir}/tools/add_contributors.py"
python "{toxinidir}/tools/towncrier_draft.py"
# NOTE(kgriffs): Renders the changelog to HTML so that the final result
# can be previewed, but then restores the changelog RST document.
[testenv:changelog_draft]
deps = -r{toxinidir}/requirements/docs
toml
towncrier
commands =
python "{toxinidir}/tools/add_contributors.py" --dry-run
python "{toxinidir}/tools/towncrier_draft.py" --dry-run
[testenv:dash]
basepython = python3.10
setenv =
DASHBUILD = True
deps = -r{toxinidir}/requirements/docs
commands =
sphinx-build -j 4 -W -E -b html docs docs/_build/html []
{toxinidir}/tools/generate_dash.sh
# --------------------------------------------------------------------
# Tutorial ("look") tests
# --------------------------------------------------------------------
[testenv:look]
basepython = python3.10
deps =
-r{toxinidir}/examples/look/requirements/test
commands =
pytest {toxinidir}/examples/look/tests
# --------------------------------------------------------------------
# ASGI tutorial ("asgilook") tests
# --------------------------------------------------------------------
[testenv:asgilook]
basepython = python3.10
deps =
-r{toxinidir}/examples/asgilook/requirements/asgilook
-r{toxinidir}/examples/asgilook/requirements/test
commands =
pytest \
--cov asgilook \
--cov-config {toxinidir}/examples/asgilook/.coveragerc \
--cov-fail-under 100 \
--cov-report term-missing \
{toxinidir}/examples/asgilook/tests/
# --------------------------------------------------------------------
# Ecosystem
# --------------------------------------------------------------------
[testenv:hug]
basepython = python3.7
deps = virtualenv
commands =
{toxinidir}/tools/testing/install_hug.sh
{toxinidir}/tools/testing/test_hug.sh
# --------------------------------------------------------------------
# E2E tests
# --------------------------------------------------------------------
[testenv:e2e_chrome]
basepython = python3.10
deps =
-r{toxinidir}/requirements/e2e
commands =
pytest {toxinidir}/e2e-tests/ --browser=chrome
[testenv:e2e_firefox]
basepython = python3.10
deps =
-r{toxinidir}/requirements/e2e
commands =
pytest {toxinidir}/e2e-tests/ --browser=firefox
# --------------------------------------------------------------------
# Wheels stuff
# --------------------------------------------------------------------
[testenv:wheel_check]
basepython = python
skipsdist = True
skip_install = True
deps = setuptools>=44
pytest
passenv = GITHUB_*
setenv =
PYTHONASYNCIODEBUG=0
PYTHONNOUSERSITE=1
FALCON_ASGI_WRAP_NON_COROUTINES=Y
FALCON_TESTING_SESSION=Y
FALCON_DISABLE_CYTHON=Y
commands =
pip uninstall --yes falcon
pip install --find-links {toxinidir}/dist --no-index --ignore-installed falcon
python --version
python -c "import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri"
python .github/workflows/scripts/verify_tag.py {toxinidir}/dist
pip install -r{toxinidir}/requirements/tests
pytest -q tests []