-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
204 lines (140 loc) · 3.92 KB
/
tox.ini
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
[tox]
envlist =
lint, mypy
coverage-py312
coverage_report
packaging
skip_missing_interpreters = {tty:True:False}
[default]
basepython = python3.12
setenv =
PY_MODULE=transmissions
PYTHONPYCACHEPREFIX={envtmpdir}/pycache
##
# Default environment: unit tests
##
[testenv]
description = run tests
basepython =
py312: python3.12
py313: python3.13
py314: python3.14
runner = uv-venv-lock-runner
uv_sync_flags = --group=unit
setenv =
{[default]setenv}
coverage: COVERAGE_FILE={toxworkdir}/coverage.{envname}
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
TRIAL_JOBS={env:TRIAL_JOBS:--jobs=2}
HYPOTHESIS_STORAGE_DIRECTORY={toxworkdir}/hypothesis
commands =
# Run trial without coverage
test: trial --random=0 {env:TRIAL_JOBS} --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}
# Run trial with coverage
# Notes:
# - Because we run tests in parallel, which uses multiple subprocesses,
# we need to drop in a .pth file that causes coverage to start when
# Python starts. See:
# https://coverage.readthedocs.io/en/coverage-5.5/subprocess.html
# - We use coverage in parallel mode, then combine here to get the results
# to get a unified result for the current test environment.
# - Use `tox -e coverage_report` to generate a report for all environments.
coverage: python -c 'f=open("{envsitepackagesdir}/zz_coverage.pth", "w"); f.write("import coverage; coverage.process_startup()\n")'
coverage: coverage erase
coverage: coverage run --parallel-mode --source="{env:PY_MODULE}" "{envdir}/bin/trial" --random=0 {env:TRIAL_JOBS} --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}
coverage: coverage combine
coverage: coverage xml -o {toxworkdir}/coverage.xml
# Run coverage reports, ignore exit status
coverage: - coverage report --skip-covered
##
# Lint
##
[testenv:lint]
description = run all linters
basepython = {[default]basepython}
runner = uv-venv-lock-runner
uv_sync_flags = --group=lint
skip_install = true
usedevelop = true
passenv = SKIP
commands =
pre-commit run {posargs:--all-files}
##
# Mypy static type checking
##
[testenv:mypy]
description = run Mypy (static type checker)
basepython = {[default]basepython}
runner = uv-venv-lock-runner
uv_sync_flags = --group=mypy
skip_install = true
usedevelop = true
commands =
mypy --cache-dir="{toxworkdir}/mypy_cache" {tty:--pretty:} {posargs:src reflex_app}
##
# Coverage report
##
[testenv:coverage_report]
description = generate coverage report
depends = coverage-py{312,313,314}
basepython = {[default]basepython}
runner = uv-venv-lock-runner
uv_sync_flags = --group=unit
skip_install = true
usedevelop = true
setenv =
{[default]setenv}
COVERAGE_FILE={toxworkdir}/coverage
commands =
coverage combine
- coverage report
- coverage html
##
# Packaging
##
[testenv:packaging]
description = check for potential packaging problems
depends = {test,coverage}-py311
basepython = {[default]basepython}
skip_install = true
usedevelop = true
runner = uv-venv-lock-runner
uv_sync_flags = --group=packaging
commands =
pip wheel --wheel-dir "{envtmpdir}/dist" --no-deps {toxinidir}
twine check "{envtmpdir}/dist/"*
##
# Run
##
[testenv:tool]
description = run CLI tool
basepython = {[default]basepython}
commands =
"{envbindir}/rtx" --config="{toxinidir}/conf/rtx.toml" {posargs}
#[testenv:app]
#
#description = run CLI application
#
#basepython = {[default]basepython}
#
#deps =
# {[default]deps}
# textual-dev
#
#commands =
# textual run --dev -c "{envbindir}/rtx" --config="{toxinidir}/conf/rtx.toml" application
#
#
#[testenv:console]
#
#description = run CLI application console
#
#basepython = {[default]basepython}
#
#skip_install = true
#
#deps =
# textual-dev
#
#commands =
# textual console