summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 31052c4e0cf0c877344dc4afabadbcbf2ac27cf4 (plain)
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
# SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
# SPDX-License-Identifier: BSD-2-Clause

[tox]
minversion = 4.1
envlist =
  ruff
  format
  mypy
  reuse
  unit-tests-no-tox
  unit-tests-tox-3
  unit-tests-tox-4
  selftest
  docs
isolated_build = True

[defs]
pyfiles_mypy =
  src/selftest \
  src/test_stages \
  unit_tests

pyfiles =
  {[defs]pyfiles_mypy} \
  src/tox_trivtags

[testenv:ruff]
skip_install = True
tags =
  check
  ruff
  quick
deps =
  -r requirements/ruff.txt
commands =
  ruff check --config config/ruff-all/pyproject.toml -- {[defs]pyfiles}

[testenv:format]
skip_install = True
tags =
  check
  quick
deps =
  -r requirements/ruff.txt
commands =
  ruff check --config config/ruff-base/pyproject.toml --select=D,I --diff -- {[defs]pyfiles}
  ruff format --check --config config/ruff-base/pyproject.toml --diff -- {[defs]pyfiles}

[testenv:reformat]
skip_install = True
tags =
  format
  manual
deps =
  -r requirements/ruff.txt
commands =
  ruff check --config config/ruff-base/pyproject.toml --select=D,I --fix -- {[defs]pyfiles}
  ruff format --config config/ruff-base/pyproject.toml -- {[defs]pyfiles}

[testenv:mypy]
skip_install = True
tags =
  check
deps =
  -r requirements/install.txt
  -r requirements/selftest.txt
  -r requirements/test.txt
  mypy >= 1, < 2

  # There seems to be some misunderstanding between mypy 1.4.1 and click 8.1.4
  click != 8.1.4

  # pytest still needs this one...
  types-setuptools >= 20
setenv =
  MYPYPATH = {toxinidir}/stubs
commands =
  mypy --follow-imports silent --exclude tox_trivtags {[defs]pyfiles_mypy}

[testenv:unit-tests-no-tox]
tags =
  tests
deps =
  -r requirements/install.txt
  -r requirements/test.txt
allowlist_externals =
  sh
commands =
  tox-stages --help
  sh -c 'if tox-stages available; then echo Waat; exit 1; else echo Not available; fi'

[testenv:unit-tests-tox-3]
tags =
  tests
deps =
  -r requirements/install.txt
  -r requirements/test.txt
  tox >= 3, < 4
commands =
  tox-stages --help
  tox-stages available
  pytest {posargs} unit_tests

[testenv:unit-tests-tox-4]
tags =
  tests
deps =
  -r requirements/install.txt
  -r requirements/test.txt
  tox >= 4, < 5
allowlist_externals =
  sh
commands =
  tox-stages --help
  tox-stages available
  pytest {posargs} unit_tests

[testenv:selftest]
tags =
  tests
deps =
  -r requirements/install.txt
  -r requirements/selftest.txt
  hatchling >= 1.14.1, < 2
  hatch-requirements-txt >= 0.4, < 0.5
setenv =
  PYTHONPATH = {toxinidir}/src
commands =
  python3 -m selftest

# The pyupgrade tool does not seem to have a "check only" mode
[testenv:pyupgrade]
skip_install = True
tags =
  check
  manual
deps =
  pyupgrade >= 3, < 4
allowlist_externals =
  sh
commands =
  sh -c 'pyupgrade --py38-plus src/test_stages/*.py src/test_stages/tox_stages/*.py src/tox_trivtags/*.py unit_tests/*.py'

[testenv:reuse]
skip_install = True
tags =
  check
  quick
deps =
  reuse >= 2, < 3
allowlist_externals =
  sh
commands =
  sh -c 'if [ -d .git ]; then reuse lint; else echo skipped; fi'

[testenv:docs]
skip_install = True
tags =
  check
  docs
deps =
  -r requirements/docs.txt
commands =
  mkdocs build

[testenv:t-single]
tags =
  something
commands =
  python3 -c 'raise NotImplementedError()'

[testenv:t-several]
tags =
  all
  the
  things
commands =
  python3 -c 'raise NotImplementedError()'

[testenv:t-special]
tags =
  So,
  how many
  $tags
  is "too many",
  'eh"?
commands =
  python3 -c 'raise NotImplementedError()'

[testenv:t-selftest-marker]
tags =
  selftest
commands =
  python3 -c 'import pathlib; pathlib.Path("selftest-marker.txt").write_text("", encoding="UTF-8")'