File: tox.ini

package info (click to toggle)
python-trio 0.32.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,992 kB
  • sloc: python: 30,164; sh: 82; makefile: 25
file content (127 lines) | stat: -rw-r--r-- 3,636 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
[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
#   * apport
# * 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

# TODO: allow specifying e.g. typing-3.11 to run with --python[-]version=3.11
[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.13
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