-
Notifications
You must be signed in to change notification settings - Fork 84
/
tox.ini
116 lines (105 loc) · 3.6 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
[tox]
envlist = py3,pep8,cover
minversion = 2.5
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=tests
passenv = *_proxy
*_PROXY
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
allowlist_externals = bash
find
rm
install_command = pip install {opts} {packages}
commands =
find . -type f -name "*.pyc" -delete
rm -Rf .testrepository/times.dbm
[testenv:py36]
basepython = python3.6
commands =
{[testenv]commands}
stestr run {posargs}
[testenv:py38]
basepython = python3.8
commands =
{[testenv]commands}
stestr run {posargs}
[testenv:cover]
commands =
{[testenv]commands}
coverage erase
python setup.py test --coverage --testr-args='{posargs}' --coverage-package-name=monasca_agent,monasca_setup
coverage report
[testenv:bandit]
commands =
# B101 - asserts used on purpose
# Following rules should be fixed in future
# B602[ subprocess_popen_with_shell_equals_true ] - removed when fixed
# B603[ subprocess_without_shell_equals_true ] - removed when fixed
# B301[ pickle ] - removed when fixed
# B303[ insecure MD5 usage ] - removed when fixed
# B311[ random ] - removed when fixed
# B403[ import_pickle ] - removed when fixed
# B404[ import_subprocess ] - removed when fixed
# B405[ import_xml_etree] - removed when fixed
# B310[ urllib_urlopen ] - removed when fixed
# B320[ xml_bad_tree ] - removed when fixed
# B410[ import_lxml ] - removed when fixed
# B411[ import_xmlrpclib ] - removed when fixed
# B605[ start_process_with_a_shell ] - removed when fixed
# B607[ start_process_with_partial_path ] - removed when fixed
# B608[ hardcoded_sql_expressions ] - removed when fixed
# B501[ request_with_no_cert_validation ] - removed when fixed
# B504[ ssl_with_no_version ] - removed when fixed
bandit -r monasca_agent -n5 -s B101,B602,B603,B301,B303,B311,B403,B404,B405,B310,B320,B410,B411,B501,B504,B605,B607,B608 -x {toxinidir}/tests
[testenv:flake8]
commands =
flake8 monasca_agent
flake8 monasca_setup
flake8 tests
[testenv:pep8]
commands =
{[testenv:flake8]commands}
{[testenv:bandit]commands}
[testenv:venv]
commands = {posargs}
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[flake8]
max-line-length = 100
max-complexity = 30
# TODO: ignored checks should be enabled in the future
# H405 multi line docstring summary not separated with an empty line
# E402 module level import not at top of file
# reason: there are numerous places where we import modules
# later for legitimate reasons
# C901 MongoDb.check function in monasca_agent/collector/checks_d/mongo.py
# is too complex. Need to be simplified with less if, for loops and then
# C901 can be removed from here.
# W504 line break after binary operator
ignore = C901,E402,H405,W504
show-source = True
exclude=.venv,.git,.tox,dist,*egg,build,tests,tests_to_fix
[flake8:local-plugins]
extension =
M001 = checks:no_mutable_default_args
M002 = checks:no_xrange
M003 = checks:validate_assertTrue
M004 = checks:validate_assertIsNone
M005 = checks:no_log_warn_check
M006 = checks:validate_assertIsNotNone
M007 = checks:assert_raisesRegexp
paths = ./monasca_agent/hacking