]> git.ipfire.org Git - thirdparty/tornado.git/blob - tox.ini
docs: Update intersphinx references for python 3.12
[thirdparty/tornado.git] / tox.ini
1 # Tox (https://tox.readthedocs.io) is a tool for running tests
2 # in multiple virtualenvs. This configuration file will run the tornado
3 # test suite on all supported python versions. To use it, "pip install tox"
4 # and then run "tox" from this directory.
5 #
6 # This configuration requires tox 1.8 or higher.
7 #
8 # Installation tips:
9 # When building pycurl on my macports-based setup, I need to either set the
10 # environment variable ARCHFLAGS='-arch x86_64' or use
11 # 'port install curl +universal' to get both 32- and 64-bit versions of
12 # libcurl.
13 [tox]
14 envlist =
15 # Basic configurations: Run the tests for each python version.
16 py38-full,py39-full,py310-full,py311-full,pypy3-full
17
18 # Build and test the docs with sphinx.
19 docs
20
21 # Run the linters.
22 lint
23
24 [testenv]
25 basepython =
26 py3: python3
27 py38: python3.8
28 py39: python3.9
29 py310: python3.10
30 py311: python3.11
31 py312: python3.12
32 pypy3: pypy3
33 # In theory, it doesn't matter which python version is used here.
34 # In practice, things like changes to the ast module can alter
35 # the outputs of the tools (especially where exactly the
36 # linter warning-suppression comments go), so we specify a
37 # python version for these builds.
38 # These versions must be synced with the versions in .github/workflows/test.yml
39 docs: python3.11
40 lint: python3.11
41
42 deps =
43 full: pycurl
44 full: twisted
45 full: pycares
46 docs: -r{toxinidir}/requirements.txt
47 lint: -r{toxinidir}/requirements.txt
48
49 setenv =
50 # Treat the extension as mandatory in testing (but not on pypy)
51 {py3,py38,py39,py310,py311,py312}: TORNADO_EXTENSION=1
52 # CI workers are often overloaded and can cause our tests to exceed
53 # the default timeout of 5s.
54 ASYNC_TEST_TIMEOUT=25
55 # Treat warnings as errors by default. We have a whitelist of
56 # allowed warnings in runtests.py, but we want to be strict
57 # about any import-time warnings before that setup code is
58 # reached. Note that syntax warnings are only reported in
59 # -opt builds because regular builds reuse pycs created
60 # during sdist installation (and it doesn't seem to be
61 # possible to set environment variables during that phase of
62 # tox).
63 {py3,py38,py39,py310,py311,pypy3}: PYTHONWARNINGS=error:::tornado
64 # Warn if we try to open a file with an unspecified encoding.
65 # (New in python 3.10, becomes obsolete when utf8 becomes the
66 # default in 3.15)
67 PYTHONWARNDEFAULTENCODING=1
68
69 # Allow shell commands in tests
70 allowlist_externals = sh
71
72
73 # All non-comment lines but the last must end in a backslash.
74 # Tox filters line-by-line based on the environment name.
75 commands =
76 # py3*: -b turns on an extra warning when calling
77 # str(bytes), and -bb makes it an error.
78 python -bb -m tornado.test {posargs:}
79 # Python's optimized mode disables the assert statement, so
80 # run the tests in this mode to ensure we haven't fallen into
81 # the trap of relying on an assertion's side effects or using
82 # them for things that should be runtime errors.
83 full: python -O -m tornado.test
84 # Note that httpclient_test is always run with both client
85 # implementations; this flag controls which client all the
86 # other tests use.
87 full: python -m tornado.test --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient
88 full: python -m tornado.test --resolver=tornado.platform.caresresolver.CaresResolver
89
90 # python will import relative to the current working directory by default,
91 # so cd into the tox working directory to avoid picking up the working
92 # copy of the files (especially important for the speedups module).
93 changedir = {toxworkdir}
94
95 [testenv:docs]
96 changedir = docs
97 # For some reason the extension fails to load in this configuration,
98 # but it's not really needed for docs anyway.
99 setenv = TORNADO_EXTENSION=0
100 commands =
101 # Build the docs
102 sphinx-build -q -E -n -W -b html . {envtmpdir}/html
103 # Run the doctests. No -W for doctests because that disallows tests
104 # with empty output.
105 sphinx-build -q -E -n -b doctest . {envtmpdir}/doctest
106
107 [testenv:lint]
108 commands =
109 flake8 {posargs:}
110 black --check --diff {posargs:tornado demos}
111 # Many syscalls are defined differently on linux and windows,
112 # so we have to typecheck both.
113 mypy --platform linux {posargs:tornado}
114 mypy --platform windows {posargs:tornado}
115 changedir = {toxinidir}