[tox] envlist = py{39,310,311,312,313,314,py310,py311} labels = check = typing, gen_exports, type_completeness, pip_compile cython = py39-cython2,py39-cython,py311-cython2,py313-cython # TODO: # * environment to check coverage # * replace ci.sh # * --verbose --durations=10 # * -p _trio_check_attrs_aliases # * mypy cache # * LSP # * use tox in CI # * switch to nox? # * move to pyproject.toml? # * this means conditional deps need to be replaced # protip: install tox-uv for faster venv generation [testenv] description = "Base environment for running tests depending on python version." # use wheels instead of sdist, significantly faster install package = wheel wheel_build_env = .pkg deps = hypothesis: hypothesis -r test-requirements.txt set_env = slow: TOX_RUN_SLOW = '--run-slow' commands = pytest {env:TOX_RUN_SLOW:} {posargs} [testenv:no_test_requirements] description = "Run tests without optional test-requirements, to see we don't accidentally depend on a library not specified in depends." deps = pytest commands = pytest --skip-optional-imports {posargs} [testenv:docs] description = "Build documentation into docs/build." deps = -r docs-requirements.txt # base_python synced with .readthedocs.yml # To avoid syncing we can make RTD call the tox environment base_python = 3.11 commands = sphinx-build {posargs:--fresh-env} docs/source docs/build [testenv:py39-cython2,py39-cython,py311-cython2,py313-cython] description = "Run cython tests." deps = # cython 3.1.0 broke stuff https://github.com/cython/cython/issues/6865 cython: cython cython2: cython<3 setuptools ; python_version >= '3.12' commands_pre = python --version cython --version cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx commands = python -m tests.cython.run_test_cython [testenv:cov-cython] deps = setuptools cython set_env = CFLAGS= -DCYTHON_TRACE_NOGIL=1 allowlist_externals = sed cp commands_pre = python --version cython --version cp pyproject.toml {temp_dir}/ sed -i "s/plugins\ =\ \\[\\]/plugins = [\"Cython.Coverage\"]/" {temp_dir}/pyproject.toml cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx commands = coverage run -m tests.cython.run_test_cython --rcfile={temp_dir}/pyproject.toml coverage combine coverage report [testenv:gen_exports] description = "Run gen_exports.py, regenerating code for public API wrappers." deps = -r test-requirements.txt base_python = 3.13 commands = python ./src/trio/_tools/gen_exports.py --test [testenv:pip_compile] description = "Run pre-commit job pip-compile" base_python = 3.13 commands = pre-commit run pip-compile --all-files [testenv:typing] description = "Run type checks: mypy on all platforms, and pyright on `src/trio[/_core]/_tests/type_tests/`." deps = -r test-requirements.txt exceptiongroup base_python = 3.10 set_env = PYRIGHT_PYTHON_IGNORE_WARNINGS=1 commands = # use mypy_annotate if running in CI? if not, should remove it mypy --platform linux mypy --platform darwin mypy --platform win32 pyright src/trio/_tests/type_tests pyright src/trio/_core/_tests/type_tests [testenv:type_completeness] description = "Check type completeness, using our wrapper around pyright --verifytypes." deps = -r test-requirements.txt exceptiongroup base_python = 3.13 set_env = PYRIGHT_PYTHON_IGNORE_WARNINGS=1 commands = python src/trio/_tests/check_type_completeness.py