forked from wolsen/snap-sunbeam
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtox.ini
133 lines (121 loc) · 4.39 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
[tox]
envlist = py3,pep8
skipsdist = True
# Automatic envs (pyXX) will only use the python version appropriate to that
# env and ignore basepython inherited from [testenv] if we set
# ignore_basepython_conflict.
ignore_basepython_conflict = True
[vars]
src_path = {toxinidir}/
tst_path = {toxinidir}/tests/
all_path = {[vars]src_path} {[vars]tst_path}
[testenv]
usedevelop = True
basepython = python3
setenv = OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands = python -m pytest {posargs}
allowlist_externals = stestr
[testenv:fmt]
setenv = VIRTUAL_ENV={envdir}
envdir = {toxworkdir}/pep8
description = Apply coding style standards to code
deps =
black
isort
commands =
isort {[vars]all_path}
black {[vars]all_path}
[testenv:fast8]
# Use same environment directory as pep8 env to save space and install time
setenv = VIRTUAL_ENV={envdir}
envdir = {toxworkdir}/pep8
commands =
{toxinidir}/tools/fast8.sh
[testenv:pep8]
deps =
black
hacking>=2.0.0
bandit!=1.6.0,>=1.1.0
flake8-import-order>=0.13 # LGPLv3
commands =
flake8
black --check --diff {[vars]src_path}
bandit -r sunbeam -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101
[testenv:bandit]
# This command runs the bandit security linter against the sunbeam
# codebase minus the tests directory. Some tests are being excluded to
# reduce the number of positives before a team inspection, and to ensure a
# passing gate job for initial addition. The excluded tests are:
# B105-B107: hardcoded password checks - likely to generate false positives
# in a gate environment
# B401: import subprocess - not necessarily a security issue; this plugin is
# mainly used for penetration testing workflow
# B603,B606: process without shell - not necessarily a security issue; this
# plugin is mainly used for penetration testing workflow
# B607: start process with a partial path - this should be a project level
# decision
# NOTE(elmiko): The following tests are being excluded specifically for
# python-sunbeam, they are being excluded to ensure that voting jobs
# in the project and in bandit integration tests continue to pass. These
# tests have generated issue within the project and should be investigated
# by the project.
# B110: try, except, pass detected - possible security issue; this should be
# investigated by the project for possible exploitation
# B605: process with a shell - possible security issue; this should be
# investigated by the project for possible exploitation
# B101: use of assert - this code will be removed when compiling to optimized
# byte code
commands =
bandit -r sunbeam -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101
[testenv:venv]
# -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:cover]
setenv =
VIRTUAL_ENV={envdir}
PYTHON=coverage run --source sunbeam --parallel-mode
commands =
coverage erase
stestr -q run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:debug]
passenv = OS_*
commands =
oslo_debug_helper -t sunbeam/tests {posargs}
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
sphinx-build -a -E -W -d doc/build/doctrees -b man doc/source doc/build/man
# Validate redirects (must be done after the docs build
whereto doc/build/html/.htaccess doc/test/redirect-tests.txt
[testenv:releasenotes]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[flake8]
max-line-length = 88
show-source = True
# H203: Use assertIs(Not)None to check for None
enable-extensions = H203
extend-ignore = E203
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,releasenotes
# W504 is disabled since you must choose between this or W503
ignore = W504, F821, H301, H306
import-order-style = pep8
application_import_names = sunbeam