-
Notifications
You must be signed in to change notification settings - Fork 52
/
tox.ini
287 lines (256 loc) · 7.52 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
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
[tox]
envlist = py{38,39,310}-{linux,macos}{,-all}
#########################################################
# Tox environments
#########################################################
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
pypy3: pypy3
[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
[testenv]
description = Run tests with coverage with pytest under current Python env
usedevelop = true
setenv = COVERAGE_FILE=.coverage.{envname}
passenv = CI
extras =
!all: test
all: all
deps =
-rexamples/scikitlearn-iris/requirements.txt
coverage
commands =
pip install -U {toxinidir}/tests/functional/gradient_descent_algo
-coverage run --source=src --parallel-mode -m pytest --durations=50 --durations-min 1 -vv --timeout=360 \
--ignore tests/unittests/algo/long \
--ignore tests/functional/backward_compatibility \
--ignore tests/functional/serving/test_frontend.py \
--ignore tests/stress {posargs}
coverage run --source=src --parallel-mode -m pytest --durations=50 --durations-min 1 -vv --timeout=360 \
--ignore tests/unittests/algo/long \
--ignore tests/functional/backward_compatibility \
--ignore tests/functional/serving/test_frontend.py \
--ignore tests/stress --lf --last-failed-no-failures none --suppress-no-test-exit-code {posargs}
coverage combine
coverage report -m
coverage xml
[testenv:algo]
description = Run unit tests for algorithms whose tests take a long time to run
usedevelop = true
setenv = COVERAGE_FILE=.coverage.{envname}
passenv = CI
extras =
all
deps =
coverage
commands =
coverage run --source=src --parallel-mode -m pytest --durations=50 --durations-min 1 -vv --timeout=360 {posargs}
coverage combine
coverage report -m
coverage xml
[testenv:mongodb]
description = Run MongoDB tests with coverage with pytest
setenv = COVERAGE_FILE=.coverage.mongodb
passenv = CI
deps =
coverage
commands =
pip install -U {toxinidir}/tests/functional/gradient_descent_algo
coverage run --parallel-mode -m pytest -vv --mongodb tests/unittests/core/database
coverage combine
coverage report -m
coverage xml
[testenv:backward-compatibility]
description = Run all versions of Orion to assert backward compatibility
setenv = COVERAGE_FILE=.coverage.backward_compatibility
passenv = CI,ORION_DB_TYPE
deps =
coverage
commands =
coverage run --parallel-mode -m pytest -vv tests/functional/backward_compatibility/test_versions.py --timeout=180
coverage combine
coverage report -m
coverage xml
[testenv:stress]
description = Run stress test of Orion
deps =
-rtests/stress/requirements.txt
commands =
python tests/stress/client/stress_experiment.py
[testenv:demo-random]
description = Run a demo with random search algorithm
setenv = COVERAGE_FILE=.coverage.random
passenv = CI
deps =
coverage
commands =
coverage run --parallel-mode src/orion/core/cli/__init__.py hunt --config tests/functional/demo/orion_config_random.yaml tests/functional/demo/black_box.py -x~'normal(30, 5)'
coverage combine
coverage report -m
# Coverage environments
[testenv:final-coverage]
description = Combine coverage data across environments (run after tests)
skip_install = True
setenv = COVERAGE_FILE=.coverage
passenv = {[testenv]passenv}
deps = coverage
commands =
coverage erase
coverage combine
coverage report -m
coverage xml
[testenv:codecov]
description = Upload coverage data to codecov (only run on CI)
setenv =
{[testenv:final-coverage]setenv}
passenv = {[testenv]passenv}
deps = codecov
commands = codecov --required
# Linting & Verification environments
[testenv:lint]
description = Lint code and docs against some standard standards
basepython = python3
skip_install = false
deps =
{[testenv:run-black]deps}
{[testenv:pylint]deps}
{[testenv:doc8]deps}
{[testenv:packaging]deps}
commands =
{[testenv:run-black]commands}
{[testenv:pylint]commands}
{[testenv:doc8]commands}
{[testenv:packaging]commands}
[testenv:pre-commit]
description = Verify code style with pre-commit hooks.
basepython = python3
skip_install = true
deps =
pre-commit == 2.18.1
commands =
pre-commit run --all-files
[testenv:run-black]
description = Run code style modification with black
basepython = python3
skip_install = true
deps =
{[testenv:pre-commit]deps}
commands =
pre-commit run black --all-files
[testenv:run-isort]
description = Run isort to fix import orders
basepython = python3
skip_install = true
deps =
{[testenv:pre-commit]deps}
commands =
pre-commit run isort --all-files
[testenv:pylint] # Will use the configuration file `.pylintrc` automatically
description = Perform static analysis and output code metrics
basepython = python3
skip_install = false
deps =
pylint == 2.14.*
commands =
pylint --ignore-paths src/orion/executor,src/orion/plotting,src/orion/testing,src/orion/serving,src/orion/benchmark,src/orion/storage,src/orion/core/io/interactive_commands src/
[testenv:doc8]
description = Impose standards on *.rst documentation files
basepython = python3
skip_install = true
deps =
-rdocs/requirements.txt
doc8 == 0.8.*
commands =
doc8 docs/src/
[testenv:packaging]
description = Check whether README.rst is reST and missing from MANIFEST.in
basepython = python3
deps =
check-manifest
readme_renderer
commands =
check-manifest
python setup.py check -r -s
## Development environments
[testenv:devel]
description = Incremental devel env command, defaults to running tests
deps =
-rexamples/scikitlearn-iris/requirements.txt
usedevelop = True
commands =
pip install -U {toxinidir}/tests/functional/gradient_descent_algo
python setup.py test --addopts '-vvv --exitfirst --looponfail {posargs}'
# Documentation environments
[testenv:build-doc-data]
description = Build database and html plots for the doc
basepython = python3
deps =
-rdocs/scripts/requirements.txt
commands =
python docs/scripts/build_database_and_plots.py {posargs}
[testenv:docs]
description = Invoke sphinx to build documentation and API reference
basepython = python3
skip_install = false
extras =
docs
pb2
commands =
sphinx-build -b html -d build/doctrees -nT docs/src/ docs/build/html
[testenv:serve-docs]
description = Host the documentation of the project and API reference in localhost
basepython = python3
skip_install = true
changedir = docs/build/html
deps =
commands =
python -m http.server 8000 --bind 127.0.0.1
# Release environments (to be removed in favor of CI with CD)
[testenv:build]
basepython = python3
skip_install = true
deps =
wheel
setuptools
commands =
python setup.py -q sdist
[testenv:release]
basepython = python3
skip_install = true
deps =
{[testenv:build]deps}
twine >= 1.5.0
commands =
{[testenv:build]commands}
twine upload --skip-existing dist/*
#########################################################
# Packages & Tools configuration
#########################################################
# Pytest configuration
[pytest]
addopts = -ra -q --color=yes
norecursedirs = .* *.egg* config docs dist build
xfail_strict = True
# Coverage configuration
[coverage:run]
branch = True
source =
src
tests
omit = **/_[a-zA-Z0-9]*.py
[coverage:report]
exclude_lines =
# Don't complain if tests don't hit defensive assertion code:
pass
raise AssertionError
raise NotImplementedError
# Doc8 configuration
[doc8]
max-line-length = 100
file-encoding = utf-8