2016-05-29 14:04:33 +00:00
|
|
|
# Tox (https://tox.readthedocs.io) is a tool for running tests
|
2011-07-17 23:52:56 +00:00
|
|
|
# in multiple virtualenvs. This configuration file will run the tornado
|
|
|
|
# test suite on all supported python versions. To use it, "pip install tox"
|
|
|
|
# and then run "tox" from this directory.
|
|
|
|
#
|
2014-10-11 14:39:39 +00:00
|
|
|
# This configuration requires tox 1.8 or higher.
|
|
|
|
#
|
2014-01-15 04:16:26 +00:00
|
|
|
# Installation tips:
|
2013-10-27 00:00:27 +00:00
|
|
|
# When building pycurl on my macports-based setup, I need to either set the
|
|
|
|
# environment variable ARCHFLAGS='-arch x86_64' or use
|
|
|
|
# 'port install curl +universal' to get both 32- and 64-bit versions of
|
|
|
|
# libcurl.
|
2011-07-17 23:52:56 +00:00
|
|
|
[tox]
|
2014-01-15 04:16:26 +00:00
|
|
|
envlist =
|
2019-11-03 20:09:18 +00:00
|
|
|
# Basic configurations: Run the tests for each python version.
|
2024-09-17 20:25:17 +00:00
|
|
|
py39-full,py310-full,py311-full,py312-full,py313-full,pypy3-full
|
2014-01-15 04:16:26 +00:00
|
|
|
|
2019-11-03 20:09:18 +00:00
|
|
|
# Build and test the docs with sphinx.
|
|
|
|
docs
|
2014-01-15 04:16:26 +00:00
|
|
|
|
2019-11-03 20:09:18 +00:00
|
|
|
# Run the linters.
|
|
|
|
lint
|
2014-01-15 04:16:26 +00:00
|
|
|
|
2011-07-17 23:52:56 +00:00
|
|
|
[testenv]
|
2014-10-11 14:39:39 +00:00
|
|
|
basepython =
|
2019-11-03 20:09:18 +00:00
|
|
|
# In theory, it doesn't matter which python version is used here.
|
|
|
|
# In practice, things like changes to the ast module can alter
|
|
|
|
# the outputs of the tools (especially where exactly the
|
2020-05-12 13:43:20 +00:00
|
|
|
# linter warning-suppression comments go), so we specify a
|
2019-11-03 20:09:18 +00:00
|
|
|
# python version for these builds.
|
2023-07-27 01:48:03 +00:00
|
|
|
# These versions must be synced with the versions in .github/workflows/test.yml
|
|
|
|
docs: python3.11
|
|
|
|
lint: python3.11
|
2014-10-11 14:39:39 +00:00
|
|
|
|
|
|
|
deps =
|
2019-11-03 20:09:18 +00:00
|
|
|
full: pycurl
|
|
|
|
full: twisted
|
|
|
|
full: pycares
|
2023-01-20 19:51:28 +00:00
|
|
|
docs: -r{toxinidir}/requirements.txt
|
|
|
|
lint: -r{toxinidir}/requirements.txt
|
2014-10-11 14:39:39 +00:00
|
|
|
|
|
|
|
setenv =
|
2019-11-03 20:09:18 +00:00
|
|
|
# Treat the extension as mandatory in testing (but not on pypy)
|
2024-10-18 19:35:39 +00:00
|
|
|
{py3,py39,py310,py311,py312,py313,py314}: TORNADO_EXTENSION=1
|
2019-11-03 20:09:18 +00:00
|
|
|
# CI workers are often overloaded and can cause our tests to exceed
|
|
|
|
# the default timeout of 5s.
|
2020-07-16 07:54:06 +00:00
|
|
|
ASYNC_TEST_TIMEOUT=25
|
2019-11-03 20:09:18 +00:00
|
|
|
# Treat warnings as errors by default. We have a whitelist of
|
|
|
|
# allowed warnings in runtests.py, but we want to be strict
|
|
|
|
# about any import-time warnings before that setup code is
|
|
|
|
# reached. Note that syntax warnings are only reported in
|
|
|
|
# -opt builds because regular builds reuse pycs created
|
|
|
|
# during sdist installation (and it doesn't seem to be
|
|
|
|
# possible to set environment variables during that phase of
|
|
|
|
# tox).
|
2024-10-18 19:51:00 +00:00
|
|
|
PYTHONWARNINGS=error:::tornado
|
2023-05-01 21:10:27 +00:00
|
|
|
# Warn if we try to open a file with an unspecified encoding.
|
|
|
|
# (New in python 3.10, becomes obsolete when utf8 becomes the
|
|
|
|
# default in 3.15)
|
|
|
|
PYTHONWARNDEFAULTENCODING=1
|
2014-10-11 14:39:39 +00:00
|
|
|
|
2023-01-20 20:19:47 +00:00
|
|
|
# Allow shell commands in tests
|
2024-06-12 01:09:34 +00:00
|
|
|
allowlist_externals = sh, env
|
2023-01-20 20:19:47 +00:00
|
|
|
|
|
|
|
|
2014-10-11 14:39:39 +00:00
|
|
|
# Tox filters line-by-line based on the environment name.
|
|
|
|
commands =
|
|
|
|
# py3*: -b turns on an extra warning when calling
|
|
|
|
# str(bytes), and -bb makes it an error.
|
2019-11-03 20:09:18 +00:00
|
|
|
python -bb -m tornado.test {posargs:}
|
2014-10-11 14:39:39 +00:00
|
|
|
# Python's optimized mode disables the assert statement, so
|
|
|
|
# run the tests in this mode to ensure we haven't fallen into
|
|
|
|
# the trap of relying on an assertion's side effects or using
|
|
|
|
# them for things that should be runtime errors.
|
2019-11-03 20:09:18 +00:00
|
|
|
full: python -O -m tornado.test
|
2014-10-11 14:39:39 +00:00
|
|
|
# Note that httpclient_test is always run with both client
|
|
|
|
# implementations; this flag controls which client all the
|
|
|
|
# other tests use.
|
2019-11-03 20:09:18 +00:00
|
|
|
full: python -m tornado.test --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient
|
|
|
|
full: python -m tornado.test --resolver=tornado.platform.caresresolver.CaresResolver
|
2011-07-17 23:52:56 +00:00
|
|
|
|
|
|
|
# python will import relative to the current working directory by default,
|
|
|
|
# so cd into the tox working directory to avoid picking up the working
|
2014-01-19 23:55:53 +00:00
|
|
|
# copy of the files (especially important for the speedups module).
|
2011-07-17 23:52:56 +00:00
|
|
|
changedir = {toxworkdir}
|
|
|
|
|
2019-11-03 20:09:18 +00:00
|
|
|
[testenv:docs]
|
2013-05-24 02:57:27 +00:00
|
|
|
changedir = docs
|
2014-10-11 14:39:39 +00:00
|
|
|
# For some reason the extension fails to load in this configuration,
|
|
|
|
# but it's not really needed for docs anyway.
|
|
|
|
setenv = TORNADO_EXTENSION=0
|
2013-05-24 02:57:27 +00:00
|
|
|
commands =
|
2019-11-03 20:09:18 +00:00
|
|
|
# Build the docs
|
2013-05-24 04:19:46 +00:00
|
|
|
sphinx-build -q -E -n -W -b html . {envtmpdir}/html
|
2024-06-12 02:01:42 +00:00
|
|
|
# Ensure that everything is either documented or ignored in conf.py
|
|
|
|
sphinx-build -q -E -n -W -b coverage . {envtmpdir}/coverage
|
2024-06-12 02:21:20 +00:00
|
|
|
# Run the doctests
|
|
|
|
sphinx-build -q -E -n -W -b doctest . {envtmpdir}/doctest
|
2015-02-08 21:09:00 +00:00
|
|
|
|
2019-11-03 20:09:18 +00:00
|
|
|
[testenv:lint]
|
2018-10-07 03:07:57 +00:00
|
|
|
commands =
|
|
|
|
flake8 {posargs:}
|
2018-11-02 16:56:28 +00:00
|
|
|
black --check --diff {posargs:tornado demos}
|
2020-10-31 16:15:23 +00:00
|
|
|
# Many syscalls are defined differently on linux and windows,
|
|
|
|
# so we have to typecheck both.
|
2024-06-12 01:09:34 +00:00
|
|
|
# Mypy currently uses the default encoding so we must unset the warning variable
|
|
|
|
# here (must be completely unset, not just set to zero/empty). Remove this
|
|
|
|
# (and the allowlist_externals for env) when mypy sets the encoding explicitly.
|
|
|
|
env -u PYTHONWARNDEFAULTENCODING mypy --platform linux {posargs:tornado}
|
|
|
|
env -u PYTHONWARNDEFAULTENCODING mypy --platform windows {posargs:tornado}
|
2023-10-14 02:39:41 +00:00
|
|
|
# We mainly lint on the oldest version of Python we support, since
|
|
|
|
# we're more likely to catch problems of accidentally depending on
|
|
|
|
# something new than of depending on something old and deprecated.
|
|
|
|
# But sometimes something we depend on gets removed so we should also
|
|
|
|
# test the newest version.
|
2024-06-12 01:09:34 +00:00
|
|
|
env -u PYTHONWARNDEFAULTENCODING mypy --platform linux --python-version 3.13 {posargs:tornado}
|
2018-07-21 17:05:53 +00:00
|
|
|
changedir = {toxinidir}
|