-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathtox.ini
310 lines (280 loc) · 8.83 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
[tox]
envlist =
py{27,34,35,36}-{local,integ,examples}-fast, nocmk, sourcebuildcheck,
docs, bandit, doc8, readme,
flake8, pylint,
flake8-tests, pylint-tests,
flake8-examples, pylint-examples,
vulture
# Additional environments:
# vulture :: Runs vulture. Prone to false-positives.
# linters :: Runs all linters over all source code.
# linters-tests :: Runs all linters over all tests.
# Operational helper environments:
# docs :: Builds Sphinx documentation.
# serve-docs :: Starts local webserver to serve built documentation.
# park :: Builds name-parking packages using pypi-parker.
# build :: Builds source and wheel dist files.
# test-release :: Builds dist files and uploads to testpypi pypirc profile.
# release :: Builds dist files and uploads to pypi pypirc profile.
[testenv:base-command]
commands = pytest --basetemp={envtmpdir} -l --cov dynamodb_encryption_sdk {posargs}
[testenv]
passenv =
# Identifies AWS KMS key id to use in integration tests
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID \
# DynamoDB Table to use in integration tests
DDB_ENCRYPTION_CLIENT_TEST_TABLE_NAME \
# Pass through AWS credentials
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
# Pass through AWS profile name (useful for local testing)
AWS_PROFILE \
# Pass through the default AWS region (used for integration tests)
AWS_DEFAULT_REGION
sitepackages = False
deps = -rtest/requirements.txt
commands =
# Only run small test scenario sets
local-fast: {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope"
integ-fast: {[testenv:base-command]commands} -m "integ and not ddb_integ and not slow and not veryslow and not nope"
ddb-fast: {[testenv:base-command]commands} -m "ddb_integ and not slow and not veryslow and not nope"
all-fast: {[testenv:base-command]commands} -m "not slow and not veryslow and not nope"
# Also run moderately large test scenario sets
local-slow: {[testenv:base-command]commands} -m "local and not veryslow and not nope"
integ-slow: {[testenv:base-command]commands} -m "integ and not ddb_integ and not veryslow and not nope"
ddb-slow: {[testenv:base-command]commands} -m "ddb_integ and not veryslow and not nope"
all-slow: {[testenv:base-command]commands} -m "not veryslow and not nope"
# Also run very large test scenario sets
local-full: {[testenv:base-command]commands} -m "local and not nope"
integ-full: {[testenv:base-command]commands} -m "integ and not ddb_integ and not nope"
ddb-full: {[testenv:base-command]commands} -m "ddb_integ and not nope"
all-full: {[testenv:base-command]commands} -m "not nope"
# Only run extremely large test scenario sets
local-nope: {[testenv:base-command]commands} -m "local and nope"
integ-nope: {[testenv:base-command]commands} -m "integ and not ddb_integ and nope"
ddb-nope: {[testenv:base-command]commands} -m "ddb_integ and nope"
all-nope: {[testenv:base-command]commands} -m "nope"
# Do not select any specific markers
manual: {[testenv:base-command]commands}
# Only run examples tests
examples: {[testenv:base-command]commands} -m "examples"
# Verify that local tests work without environment variables present
[testenv:nocmk]
basepython = python3
sitepackages = False
deps = -rtest/requirements.txt
commands = {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope"
# Verify that tests can be successfully run from the source build.
[testenv:sourcebuildcheck]
basepython = python3
sitepackages = False
recreate = True
deps =
{[testenv:build]deps}
commands =
{[testenv:build]commands}
{toxinidir}/test/source-build-check.sh {envtmpdir} {toxinidir}/dist
# mypy
[testenv:mypy-coverage]
commands =
# Make mypy linecoverage report readable by coverage
python -c \
"t = open('.coverage', 'w');\
c = open('build/coverage.json').read();\
t.write('!coverage.py: This is a private format, don\'t read it directly!\n');\
t.write(c);\
t.close()"
coverage report -m
[testenv:mypy-common]
basepython = python3
deps =
coverage
mypy<=0.560
mypy_extensions
typing>=3.6.2
[testenv:mypy-py3]
basepython = {[testenv:mypy-common]basepython}
deps = {[testenv:mypy-common]deps}
commands =
python -m mypy \
--linecoverage-report build \
src/dynamodb_encryption_sdk/ \
{posargs}
{[testenv:mypy-coverage]commands}
[testenv:mypy-py2]
basepython = {[testenv:mypy-common]basepython}
deps = {[testenv:mypy-common]deps}
commands =
python -m mypy \
--py2 \
--linecoverage-report build \
src/dynamodb_encryption_sdk/ \
{posargs}
{[testenv:mypy-coverage]commands}
# Linters
[testenv:flake8]
basepython = python3
deps =
flake8
flake8-docstrings
flake8-import-order
# https://github.com/JBKahn/flake8-print/pull/30
flake8-print>=3.1.0
commands =
flake8 \
src/dynamodb_encryption_sdk/ \
setup.py \
doc/conf.py
[testenv:flake8-tests]
basepython = {[testenv:flake8]basepython}
deps = {[testenv:flake8]deps}
commands =
flake8 \
# Ignore F811 redefinition errors in tests (breaks with pytest-mock use)
# Ignore D103 docstring requirements for tests
--ignore F811,D103 \
test/
[testenv:flake8-examples]
basepython = {[testenv:flake8]basepython}
deps = {[testenv:flake8]deps}
commands =
flake8 \
# Examples should not treat any imports as application-local.
--application-import-names= \
examples/src/
flake8 \
# Ignore F811 redefinition errors in tests (breaks with fixture use)
# Ignore D103 docstring requirements for tests
--ignore F811,D103 \
examples/test/
[testenv:pylint]
basepython = python3
deps =
{[testenv]deps}
pyflakes
pylint
commands =
pylint \
--rcfile=src/pylintrc \
src/dynamodb_encryption_sdk/ \
setup.py \
doc/conf.py
[testenv:pylint-tests]
basepython = {[testenv:pylint]basepython}
deps = {[testenv:pylint]deps}
commands =
pylint \
--rcfile=test/pylintrc \
test/unit/ \
test/acceptance/ \
test/functional/ \
test/integration/
[testenv:pylint-examples]
basepython = {[testenv:pylint]basepython}
deps = {[testenv:pylint]deps}
commands =
pylint --rcfile=examples/src/pylintrc examples/src/
pylint --rcfile=examples/test/pylintrc examples/test/
# Clear out any generated files from doc/
[testenv:resetdocs]
whitelist_externals =
mkdir
rm
commands =
# Make sure that the directory exists to avoid
# potential side effects of using rm -f
mkdir -p {toxinidir}/doc/lib/generated
rm -r {toxinidir}/doc/lib/generated
[testenv:doc8]
basepython = python3
whitelist_externals = {[testenv:resetdocs]whitelist_externals}
deps =
sphinx
doc8
commands =
{[testenv:resetdocs]commands}
doc8 doc/index.rst doc/lib/ README.rst CHANGELOG.rst
[testenv:readme]
basepython = python3
deps = readme_renderer
commands = python setup.py check -r -s
[testenv:bandit]
basepython = python3
deps = bandit
commands = bandit -r src/dynamodb_encryption_sdk/
# Prone to false positives: only run independently
[testenv:vulture]
basepython = python3
deps = vulture
commands = vulture src/dynamodb_encryption_sdk/
[testenv:linters]
basepython = python3
deps =
{[testenv:flake8]deps}
{[testenv:pylint]deps}
{[testenv:doc8]deps}
{[testenv:readme]deps}
{[testenv:bandit]deps}
commands =
{[testenv:flake8]commands}
{[testenv:pylint]commands}
{[testenv:doc8]commands}
{[testenv:readme]commands}
{[testenv:bandit]commands}
[testenv:linters-tests]
basepython = python3
deps =
{[testenv:flake8-tests]deps}
{[testenv:pylint-tests]deps}
commands =
{[testenv:flake8-tests]commands}
{[testenv:pylint-tests]commands}
# Documentation
[testenv:docs]
basepython = python3
deps = -rdoc/requirements.txt
commands =
sphinx-build -E -c doc/ -b html doc/ doc/build/html
sphinx-build -E -c doc/ -b linkcheck doc/ doc/build/html
[testenv:serve-docs]
basepython = python3
skip_install = true
changedir = doc/build/html
deps =
commands =
python -m http.server {posargs}
# Release tooling
[testenv:park]
basepython = python3.6
skip_install = true
deps =
pypi-parker
setuptools
commands = python setup.py park
# Release tooling
[testenv:build]
basepython = python3
skip_install = true
deps =
wheel
setuptools
commands =
python setup.py sdist bdist_wheel
[testenv:test-release]
basepython = python3
skip_install = true
deps =
{[testenv:build]deps}
twine
commands =
{[testenv:build]commands}
twine upload --skip-existing --repository testpypi dist/*
[testenv:release]
basepython = python3
skip_install = true
deps =
{[testenv:build]deps}
twine
commands =
{[testenv:build]commands}
twine upload --skip-existing --repository pypi dist/*