# 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] envlist = # Basic configurations: Run the tests in both minimal installations # and with all optional dependencies. # (pypy3 doesn't have any optional deps yet) {py35,py36,py37,pypy3}, {py35,py36,py37}-full, # Also run the tests with each possible replacement of a default # component (only one 3.x version unless there are known differences). # Alternate HTTP clients. py3-curl, # Alternate Resolvers. py3-full-caresresolver, # Other configurations; see comments below. py3-opt, py3-{lang_c,lang_utf8}, # Ensure the sphinx build has no errors or warnings py3-sphinx-docs, # Run the doctests via sphinx (which covers things not run # in the regular test suite and vice versa) py3-sphinx-doctest, py3-lint py3-mypy # Tox doesn't like that we specify py3==py37 ignore_basepython_conflict=True [testenv] # Most of these are defaults, but if you specify any you can't fall back # defaults for the others. basepython = py35: python3.5 py36: python3.6 py37: python3.7 pypy: pypy pypy3: pypy3 py2: python2.7 py3: python3.7 deps = # cpython-only deps: pycurl installs but curl_httpclient doesn't work; # twisted mostly works but is a bit flaky under pypy. {py35,py36,py37}-full: pycurl py3: pycurl>=7.19.3.1 # twisted is cpython only. {py35,py36,py37}-full: twisted py3: twisted {py3,py35,py36,py37}-full: pycares sphinx: -r{toxinidir}/docs/requirements.txt lint: flake8 lint: black==19.3b0 mypy: mypy==0.701 setenv = # The extension is mandatory on cpython. {py3,py35,py36,py37}: TORNADO_EXTENSION=1 # 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. lang_c: LANG=C lang_utf8: LANG=en_US.utf-8 # tox's parser chokes if all the setenv entries are conditional. DUMMY=dummy {py3,py35,py36,py37}-no-ext: TORNADO_EXTENSION=0 # All non-comment lines but the last must end in a backslash. # Tox filters line-by-line based on the environment name. commands = python \ # py3*: -b turns on an extra warning when calling # str(bytes), and -bb makes it an error. -bb \ # 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). "-Werror" \ # Virtualenv hits a deprecation warning very early which we must # suppress here. "-Wignore:::site" \ # 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. opt: -O \ -m tornado.test.runtests \ # Note that httpclient_test is always run with both client # implementations; this flag controls which client all the # other tests use. curl: --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient \ caresresolver: --resolver=tornado.platform.caresresolver.CaresResolver \ {posargs:} # 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:py3-sphinx-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 = sphinx-build -q -E -n -W -b html . {envtmpdir}/html [testenv:py3-sphinx-doctest] changedir = docs setenv = TORNADO_EXTENSION=0 # No -W for doctests because that disallows tests with empty output. commands = sphinx-build -q -E -n -b doctest . {envtmpdir}/doctest [testenv:py3-lint] commands = flake8 {posargs:} black --check --diff {posargs:tornado demos} changedir = {toxinidir} [testenv:py3-mypy] commands = mypy {posargs:tornado} changedir = {toxinidir}