-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtox.ini
More file actions
332 lines (293 loc) · 9.34 KB
/
Copy pathtox.ini
File metadata and controls
332 lines (293 loc) · 9.34 KB
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# Generated from:
# https://github.com/plone/meta/tree/main/src/plone/meta/default
# See the inline comments on how to expand/tweak this configuration file
[tox]
# We need 4.4.0 for constrain_package_deps.
min_version = 4.4.0
envlist =
lint
test
dependencies
py{310,311,312,313,314}-{integration,unit}
owncoverage
buildout
buildout5
[base-test]
# generic configuration for custom integration and unit tests
# For a long time this was only for integration tests.
# But this required arcane incantations in test_loader.py, calling egg_info
# and distutils.core from setuptools, which could lead to the egg_info dirs
# being created next to setup.py instead of in the src directory.
# Result: py312-unit on its own would fail, but it would pass if you
# first called py312-integration. So use this for both types of test.
# example.ploneintegration depends on plone.autoinclude,
# and 'deps' is handled before 'usedevelop', so we need '.' in the deps.
# Also, we want all test packages in development mode,
# otherwise when you make a change, you must recreate the environment.
deps =
zope.testrunner
-e .
-e test-packages/example.basetestpackage
-e test-packages/example.addon
-e test-packages/example.different
-e test-packages/example.different2
-e test-packages/example.metaoverrides
-e test-packages/example.ploneaddon
-e test-packages/example.plone-dash-addon
-e test-packages/example.ploneintegration
-e test-packages/example.zopeaddon
-e test-packages/example.zopeintegration
-e test-packages/example.multipleeps
-e test-packages/ExampleCamelCase
-e test-packages/namespaceexample.native
-e test-packages/namespaceexample2.pkgresources
-e test-packages/namespaceexample.pkgutilns
[testenv:py{310,311,312,313,314}-integration]
# Integration tests: run only the tests of the test packages.
# Do not run plone.autoinclude tests.
usedevelop = false
skip_install = true
deps = {[base-test]deps}
# With --test-path=test-packages we find no tests.
# Only paths to the src directories work.
# Also, we need everything on one line.
commands =
zope-testrunner --test-path=test-packages/example.addon/src --test-path=test-packages/example.different/src --test-path=test-packages/example.different2/src --test-path=test-packages/example.metaoverrides/src --test-path=test-packages/example.ploneaddon/src --test-path=test-packages/example.ploneintegration/src --test-path=test-packages/example.zopeaddon/src --test-path=test-packages/example.zopeintegration/src --test-path=test-packages/example.multipleeps/src --test-path=test-packages/namespaceexample.native/src --test-path=test-packages/namespaceexample2.pkgresources/src --test-path=test-packages/namespaceexample.pkgutilns/src []
[testenv:py{310,311,312,313,314}-unit]
usedevelop = false
skip_install = true
deps = {[base-test]deps}
commands =
zope-testrunner --test-path=src
[testenv:owncoverage]
# Our setup is too different to use the standard coverage env from plone.meta.
usedevelop = false
skip_install = true
deps =
{[base-test]deps}
coverage
commands =
coverage run --branch --source plone.autoinclude {envbindir}/zope-testrunner --test-path={toxinidir}/src -s plone.autoinclude {posargs}
coverage report -m --format markdown
coverage xml
coverage html
[testenv:buildout]
basepython = python3
skip_install = true
deps =
pip == 25.2
setuptools == 80.9.0
zc.buildout == 4.1.12
commands_pre =
python -m pip list
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir}
commands =
{envbindir}/test-unit {posargs:-cv}
{envbindir}/test-integration {posargs:-cv}
[testenv:buildout5]
basepython = python3
skip_install = true
deps =
pip == 26.0.1
setuptools == 81.0.0
zc.buildout == 5.1.2
commands_pre =
python -m pip list
{envbindir}/buildout -nc {toxinidir}/buildout5.cfg buildout:directory={envdir}
commands =
{envbindir}/test-unit {posargs:-cv}
{envbindir}/test-integration {posargs:-cv}
##
# Add extra configuration options in .meta.toml:
# - to specify a custom testing combination of Plone and python versions, use `test_matrix`
# Use ["*"] to use all supported Python versions for this Plone version.
# - to disable the test matrix entirely, set `use_test_matrix = false`
# - to specify extra custom environments, use `envlist_lines`
# - to specify extra `tox` top-level options, use `config_lines`
# [tox]
# test_matrix = {"6.2" = ["3.13", "3.12"], "6.1" = ["*"]}
# envlist_lines = """
# my_other_environment
# """
# config_lines = """
# my_extra_top_level_tox_configuration_lines
# """
##
[testenv:init]
description = Prepare environment
skip_install = true
allowlist_externals =
echo
commands =
echo "Initial setup complete"
[testenv:format]
description = automatically reformat code
skip_install = true
deps =
pre-commit
commands =
pre-commit run -a pyupgrade
pre-commit run -a isort
pre-commit run -a black
pre-commit run -a zpretty
[testenv:lint]
description = run linters that will help improve the code style
skip_install = true
deps =
pre-commit
commands =
pre-commit run -a
[testenv:dependencies]
description = check if the package defines all its dependencies
skip_install = true
deps =
build
setuptools<82.0.0
z3c.dependencychecker==2.14.3
commands =
python -m build --sdist
dependencychecker
[testenv:dependencies-graph]
description = generate a graph out of the dependencies of the package
skip_install = false
allowlist_externals =
sh
deps =
pipdeptree==2.5.1
graphviz # optional dependency of pipdeptree
commands =
sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg'
[test_runner]
deps = zope.testrunner
test =
zope-testrunner --all --test-path={toxinidir}/src -s plone.autoinclude {posargs}
coverage =
coverage run --branch --source plone.autoinclude {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s plone.autoinclude {posargs}
coverage report -m --format markdown
coverage xml
coverage html
[base]
description = shared configuration for tests and coverage
use_develop = true
skip_install = false
constrain_package_deps = true
set_env =
ROBOT_BROWSER=headlesschrome
##
# Specify extra test environment variables in .meta.toml:
# [tox]
# test_environment_variables = """
# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/
# """
#
# Set constrain_package_deps .meta.toml:
# [tox]
# constrain_package_deps = false
##
deps =
{[test_runner]deps}
##
# Specify additional deps in .meta.toml:
# [tox]
# test_deps_additional = """
# -esources/plonegovbr.portal_base[test]
# """
#
# Specify a custom constraints file in .meta.toml:
# [tox]
# constraints_file = "https://my-server.com/constraints.txt"
##
extras =
##
# Add extra configuration options in .meta.toml:
# [tox]
# skip_test_extra = true
# test_extras = """
# tests
# widgets
# """
#
# Add extra configuration options in .meta.toml:
# [tox]
# testenv_options = """
# basepython = /usr/bin/python3.8
# """
##
[testenv:test]
description = run the distribution tests
use_develop = {[base]use_develop}
skip_install = {[base]skip_install}
constrain_package_deps = {[base]constrain_package_deps}
set_env = {[base]set_env}
deps =
{[test_runner]deps}
commands = {[test_runner]test}
extras = {[base]extras}
[testenv]
description = run the distribution tests (generative environments)
use_develop = {[base]use_develop}
skip_install = {[base]skip_install}
constrain_package_deps = {[base]constrain_package_deps}
set_env = {[base]set_env}
deps = {[base]deps}
commands = {[test_runner]test}
extras = {[base]extras}
[testenv:coverage]
description = get a test coverage report
use_develop = {[base]use_develop}
skip_install = {[base]skip_install}
constrain_package_deps = {[base]constrain_package_deps}
set_env = {[base]set_env}
deps =
{[test_runner]deps}
coverage
commands = {[test_runner]coverage}
extras = {[base]extras}
[testenv:release-check]
description = ensure that the distribution is ready to release
skip_install = true
deps =
twine
build
towncrier
commands =
# fake version to not have to install the package
# we build the change log as news entries might break
# the README that is displayed on PyPI
towncrier build --version=100.0.0 --yes
python -m build --sdist
twine check dist/*
[testenv:circular]
description = ensure there are no cyclic dependencies
use_develop = true
skip_install = false
# Here we must always constrain the package deps to what is already installed,
# otherwise we simply get the latest from PyPI, which may not work.
constrain_package_deps = true
set_env =
##
# Specify extra test environment variables in .meta.toml:
# [tox]
# test_environment_variables = """
# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/
# """
##
allowlist_externals =
sh
deps =
pipdeptree
pipforester
commands =
# Generate the full dependency tree
sh -c 'pipdeptree -j > forest.json'
# Generate a DOT graph with the circular dependencies, if any
pipforester -i forest.json -o forest.dot --cycles
# Report if there are any circular dependencies, i.e. error if there are any
pipforester -i forest.json --check-cycles -o /dev/null
##
# Add extra configuration options in .meta.toml:
# [tox]
# extra_lines = """
# _your own configuration lines_
# """
##