summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 4857188bd6acb59e226803c9ddb45ee3251d23f0 (plain)
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
[tox]
minversion = 3.18.0
envlist = py3,flake8
ignore_basepython_conflict = True

[testenv]
basepython = python3
setenv =
  VIRTUAL_ENV={envdir}
  LANGUAGE=C.UTF-8
  LC_ALL=C.UTF-8
  OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
  OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
  OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
  OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:180}
  PYTHONDONTWRITEBYTECODE=1
  PYTHONWARNINGS=default::DeprecationWarning,ignore::DeprecationWarning:distutils,ignore::DeprecationWarning:site
passenv =
  http_proxy
  HTTP_PROXY
  https_proxy
  HTTPS_PROXY
  no_proxy
  NO_PROXY
  OS_DEBUG
usedevelop = True
install_command =
  pip install {opts} {packages}
commands =
  find . -type f -name "*.py[c|o]" -delete
  rm -f .testrepository/times.dbm
  stestr run {posargs}
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
allowlist_externals =
  sh
  find
  rm

[testenv:docs]
allowlist_externals =
  rm
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/doc/requirements.txt
commands =
    rm -rf doc/build
    sphinx-build -W -b html doc/source doc/build/html

[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_externals =
  make
commands =
  sphinx-build -W -b latex doc/source doc/build/pdf
  make -C doc/build/pdf

[testenv:cover]
setenv =
    {[testenv]setenv}
    PYTHON=coverage run --source designate --parallel-mode
commands =
  coverage erase
  find . -type f -name "*.pyc" -delete
  stestr run --no-subunit-trace {posargs}
  coverage combine
  coverage html -d cover
  coverage xml -o cover/coverage.xml
  coverage report --fail-under=85 --skip-covered

[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r designate -n5 -x 'designate/tests/*' -t \
  B505,B504,B503,B502,B501,B604,B605,B001,B601,B602,B701,B609,B702,\
  B608,B506,B312,B310,B411,B108,B103,B102,B308,B302,B307,B306

[testenv:debug]
commands = oslo_debug_helper -t designate/tests {posargs}

[testenv:flake8]
deps = -r{toxinidir}/test-requirements.txt
commands = sh tools/pretty_flake8.sh
  {[testenv:bandit]commands}

[testenv:pep8]
deps = -r{toxinidir}/test-requirements.txt
commands = sh tools/pretty_flake8.sh
  {[testenv:bandit]commands}
  doc8 {posargs}

[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/designate/designate-config-generator.conf

[testenv:genpolicy]
commands = oslopolicy-sample-generator --config-file etc/designate/designate-policy-generator.conf

[testenv:bashate]
deps = bashate
allowlist_externals = bash
commands = bash -c "find {toxinidir}/devstack         \
         -not \( -type d -name .?\* -prune \)         \
         -not \( -type d -name doc -prune \)          \
         -type f                                      \
         -not -name \*~                               \
         -not -name \*.md                             \
         \(                                           \
          -name \*.sh -or                             \
          -name \*rc -or                              \
          -name functions\* -or                       \
          -wholename \*/lib/\*                        \
         \)                                           \
         -print0 | xargs -0 bashate -v"

[testenv:pip-check-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages
# this also means that pip-missing-reqs must be installed separately, outside
# of the requirements.txt files
deps = pip-check-reqs
       -r{toxinidir}/requirements.txt
commands=pip-missing-reqs -d --ignore-file=designate/tests/* designate

[testenv:api-ref]
# This environment is called from CI scripts to test and publish
# the API Ref to docs.openstack.org.
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/doc/requirements.txt
commands =
  rm -rf api-ref/build
  sphinx-build -E -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html

[testenv:releasenotes]
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/doc/requirements.txt
commands =
    rm -rf releasenotes/build
    sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:venv]
commands = {posargs}
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
       -r{toxinidir}/doc/requirements.txt

[doc8]
ignore-path = .venv,.git,.tox,*designate/locale*,*lib/python*,*designate.egg*,api-ref/build,doc/build,doc/source/contributor/api

[flake8]
# ignored flake8 codes:
# H105 don't use author tags. We use version control instead
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line
# H501 Do not use locals() or self.__dict__ for string formatting.
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
# W504 line break after binary operator
ignore = H105,H404,H405,H501,E126,E128,W504
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject

[hacking]
import_exceptions = designate.i18n

[flake8:local-plugins]
extension =
  D701 = checks:mutable_default_arguments
  D703 = checks:check_explicit_underscore_import
  D704 = checks:no_import_graduated_oslo_libraries
  D705 = checks:use_timeutils_utcnow
  D706 = checks:no_translate_debug_logs
  D707 = checks:check_no_basestring
  D708 = checks:check_python3_xrange
  D709 = checks:check_no_log_audit
  D710 = checks:check_no_log_warn
  D711 = checks:check_line_continuation_no_backslash
paths = ./designate/hacking

[testenv:dnspython-latest]
commands =
  python -m pip install -U dnspython --pre
  {[testenv]commands}