130 lines
5.2 KiB
INI
130 lines
5.2 KiB
INI
# Tox (https://tox.readthedocs.io) is a tool for running tests
|
|
# 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.
|
|
#
|
|
# This configuration requires tox 1.8 or higher.
|
|
#
|
|
# Installation tips:
|
|
# 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.
|
|
[tox]
|
|
# When tox is run from a venv (instead of a virtualenv), it can get confused
|
|
# unless tox-venv is also installed.
|
|
requires = tox-venv
|
|
envlist =
|
|
# Basic configurations: Run the tests for each python version.
|
|
py35-full,py36-full,py37-full,py38-full,pypy3-full
|
|
|
|
# Build and test the docs with sphinx.
|
|
docs
|
|
|
|
# Run the linters.
|
|
lint
|
|
|
|
# Allow shell commands in tests
|
|
whitelist_externals = /bin/sh
|
|
|
|
[testenv]
|
|
basepython =
|
|
py3: python3
|
|
py35: python3.5
|
|
py36: python3.6
|
|
py37: python3.7
|
|
py38: python3.8
|
|
pypy3: pypy3
|
|
# 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
|
|
# linter warning-supression comments go), so we specify a
|
|
# python version for these builds.
|
|
docs: python3.8
|
|
lint: python3.8
|
|
|
|
deps =
|
|
full: pycurl
|
|
full: twisted
|
|
full: pycares
|
|
docs: -r{toxinidir}/docs/requirements.txt
|
|
lint: flake8
|
|
lint: black==19.10b0
|
|
lint: mypy==0.740
|
|
|
|
setenv =
|
|
# Treat the extension as mandatory in testing (but not on pypy)
|
|
{py3,py36,py37,py38}: TORNADO_EXTENSION=1
|
|
# CI workers are often overloaded and can cause our tests to exceed
|
|
# the default timeout of 5s.
|
|
ASYNC_TEST_TIMEOUT=15
|
|
# 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).
|
|
# ResourceWarnings are too noisy on py35 so don't enable
|
|
# warnings-as-errors there.
|
|
{py3,py36,py37,py38,pypy3}: PYTHONWARNINGS=error:::tornado
|
|
|
|
|
|
# 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.
|
|
python -bb -m tornado.test {posargs:}
|
|
# 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.
|
|
full: python -O -m tornado.test
|
|
# In python 3, opening files in text mode uses a
|
|
# system-dependent encoding by default. Run the tests with "C"
|
|
# (ascii) and "utf-8" locales to ensure we don't have hidden
|
|
# dependencies on this setting.
|
|
full: sh -c 'LANG=C python -m tornado.test'
|
|
full: sh -c 'LANG=en_US.utf-8 python -m tornado.test'
|
|
# Note that httpclient_test is always run with both client
|
|
# implementations; this flag controls which client all the
|
|
# other tests use.
|
|
full: python -m tornado.test --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient
|
|
full: python -m tornado.test --resolver=tornado.platform.caresresolver.CaresResolver
|
|
# Run the tests once from the source directory to detect issues
|
|
# involving relative __file__ paths; see
|
|
# https://github.com/tornadoweb/tornado/issues/1780
|
|
full: sh -c '(cd {toxinidir} && unset TORNADO_EXTENSION && python -m tornado.test)'
|
|
|
|
|
|
# python will import relative to the current working directory by default,
|
|
# so cd into the tox working directory to avoid picking up the working
|
|
# copy of the files (especially important for the speedups module).
|
|
changedir = {toxworkdir}
|
|
|
|
# tox 1.6 passes --pre to pip by default, which currently has problems
|
|
# installing pycurl (https://github.com/pypa/pip/issues/1405).
|
|
# Remove it (it's not a part of {opts}) to only install real releases.
|
|
install_command = pip install {opts} {packages}
|
|
|
|
[testenv:docs]
|
|
changedir = docs
|
|
# For some reason the extension fails to load in this configuration,
|
|
# but it's not really needed for docs anyway.
|
|
setenv = TORNADO_EXTENSION=0
|
|
commands =
|
|
# Build the docs
|
|
sphinx-build -q -E -n -W -b html . {envtmpdir}/html
|
|
# Run the doctests. No -W for doctests because that disallows tests
|
|
# with empty output.
|
|
sphinx-build -q -E -n -b doctest . {envtmpdir}/doctest
|
|
|
|
[testenv:lint]
|
|
commands =
|
|
flake8 {posargs:}
|
|
black --check --diff {posargs:tornado demos}
|
|
mypy {posargs:tornado}
|
|
changedir = {toxinidir}
|