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-06-07 20:20:54 +00:00
|
|
|
py38-full,py39-full,py310-full,py311-full,py312-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
|
|
|
py3: python3
|
|
|
|
py38: python3.8
|
2020-09-30 14:52:21 +00:00
|
|
|
py39: python3.9
|
2022-01-17 01:37:54 +00:00
|
|
|
py310: python3.10
|
2022-01-30 20:01:14 +00:00
|
|
|
py311: python3.11
|
2022-11-19 20:59:31 +00:00
|
|
|
py312: python3.12
|
2024-06-07 20:20:54 +00:00
|
|
|
py313: python3.13
|
2014-10-11 14:39:39 +00:00
|
|
|
pypy3: pypy3
|
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-06-07 20:20:54 +00:00
|
|
|
{py3,py38,py39,py310,py311,py312,py313}: 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-06-07 20:20:54 +00:00
|
|
|
{py3,py38,py39,py310,py311,py312,py313,pypy3}: 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
|
|
|
|
allowlist_externals = sh
|
|
|
|
|
|
|
|
|
2014-10-11 14:39:39 +00:00
|
|
|
# All non-comment lines but the last must end in a backslash.
|
|
|
|
# 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
|
2019-11-03 20:09:18 +00:00
|
|
|
# Run the doctests. No -W for doctests because that disallows tests
|
|
|
|
# with empty output.
|
|
|
|
sphinx-build -q -E -n -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.
|
|
|
|
mypy --platform linux {posargs:tornado}
|
|
|
|
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-07 20:20:54 +00:00
|
|
|
mypy --platform linux --python-version 3.13 {posargs:tornado}
|
2018-07-21 17:05:53 +00:00
|
|
|
changedir = {toxinidir}
|