- We use
blackas code formatter and recommend configuring your editor to run this automatically (using the version specified inrequirements.txt). Commits that are not properly formatted byblackwill be rejected in CI. - Before committing, it is recommended to run
tox -e lint,docs,py3. This will verify that the code is formatted correctly, type checking withmypypasses, thesphinxbuild for docs has no errors, and the main test suite passes with the current version of python. - Nearly all code changes should have new or updated tests covering the changed behavior. Red/green TDD is encouraged.
- We use
toxas a test runner to run tests in various configurations with the correct dependencies.tox -e py3runs most of the tests, whiletox -e py3-fullcan be used to run a more extensive version of the test suite which as extra dependencies. The-fullconfigurations are necessary when working on certain modules, includingcurl_httpclient.py,twisted.py, orpycares.py. - The fastest way to run the tests is to bypass
toxand runpython3 -m tornado.test. To run a subset of tests, add a module, class, or method name to the command line:python3 -m tornado.test.httputil_test. - Tests can also be run with the standard library's
unittestpackage CLI. This is useful for integration with some editors. - Tornado does not use
pytest. Some effort has been made to make the tests work with thepytestrunner, but this is not maintained.
We use Sphinx with the autodoc extension to build our docs. To build the docs run
tox -e docs and find the output in ./.tox/docs/tmp/html/index.html
Tornado has a neutral stance towards AI-generated code. All pull requests, whether human or machine-generated, are subject to strict code review standards. However, PRs that appear to be AI-generated and contain clear flaws (such as failing CI) may be closed without detailed review.