summaryrefslogtreecommitdiff
path: root/tox.ini
blob: fb0fe98f53cd87d644a5b5747e6726e13a5ba54e (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
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
[tox]
minversion = 3.1
envlist = pep8,py36,py38,releasenotes,npm
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

[testenv]
basepython = python3
usedevelop = True
setenv =
  VIRTUAL_ENV = {envdir}
  PYTHONDONTWRITEBYTECODE = 1
  PYTHONWARNINGS = once
  py{3,36,37}:PYTHONWARNINGS = once,ignore::ImportWarning:backports

whitelist_externals =
  bash
  find
deps =
  -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt
commands =
  find . -type f -name "*.pyc" -delete
  bash {toxinidir}/tools/unit_tests.sh {toxinidir} {posargs}

[testenv:lower-constraints]
deps =
  -c{toxinidir}/lower-constraints.txt
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt

[testenv:venv]
envdir = {toxworkdir}/venv
commands = {posargs}

[testenv:pep8]
envdir = {toxworkdir}/venv
setenv =
  DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
commands =
  flake8 {posargs}
  {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only
  bash {toxinidir}/tools/find_executables.sh
  pylint -j 4 --verbose --rcfile=.pylintrc -f colorized openstack_dashboard openstack_auth horizon

[testenv:cover]
envdir = {toxworkdir}/venv
commands =
  coverage erase
  coverage run pytest horizon/test/ --ds=horizon.test.settings {posargs}
  coverage run -a pytest openstack_dashboard --ds=openstack_dashboard.test.settings -m "not integration" {posargs}
  coverage run -a pytest openstack_auth/tests --ds=openstack_auth.tests.settings {posargs}
  coverage xml
  coverage html

[testenv:selenium]
envdir = {toxworkdir}/venv
setenv =
  {[testenv]setenv}
  WITH_SELENIUM=1
commands =
  find . -type f -name "*.pyc" -delete
  bash {toxinidir}/tools/selenium_tests.sh {toxinidir} {posargs}

[testenv:selenium-headless]
envdir = {toxworkdir}/venv
setenv =
  {[testenv]setenv}
  SELENIUM_HEADLESS=1
  WITH_SELENIUM=1
commands =
  find . -type f -name "*.pyc" -delete
  bash {toxinidir}/tools/selenium_tests.sh {toxinidir} {posargs}

[testenv:selenium-phantomjs]
envdir = {toxworkdir}/venv
setenv =
  {[testenv]setenv}
  SELENIUM_PHANTOMJS=1
  WITH_SELENIUM=1
commands =
  find . -type f -name "*.pyc" -delete
  bash {toxinidir}/tools/selenium_tests.sh {toxinidir} {posargs}

[testenv:integration]
envdir = {toxworkdir}/venv
# Run integration tests only
passenv =
  DISPLAY
  FFMPEG_INSTALLED
setenv =
  INTEGRATION_TESTS=1
  SELENIUM_HEADLESS=False
commands =
  oslo-config-generator --namespace openstack_dashboard_integration_tests
  pytest {toxinidir}/openstack_dashboard/test/integration_tests --ds=openstack_dashboard.test.settings -v --junitxml="{toxinidir}/test_reports/integration_test_results.xml" --html="{toxinidir}/test_reports/integration_test_results.html" --self-contained-html {posargs}

[testenv:npm]
passenv =
  HOME
  DISPLAY
commands =
  nodeenv -p
  npm install
  npm run {posargs:test}

[testenv:tests_system_packages]
# Provide an environment for system packagers that dont want anything from pip
# Any extra deps needed for this env can be passed by setting TOX_EXTRA_DEPS
sitepackages = True
passenv = TOX_EXTRA_DEPS http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
# Sets deps to an empty list so nothing is installed from pip
deps =
commands =
  pip install -U {env:TOX_EXTRA_DEPS:}
  {[testenv]commands}

[testenv:docs]
# We need to install horizon dependecies to build module references
deps =
  -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/doc/requirements.txt
commands =
  sphinx-build -j auto -W -b html doc/source doc/build/html
  doc8 doc/source

[testenv:pdf-docs]
basepython = python3
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
whitelist_externals =
  make
commands =
  sphinx-build -j auto -W -b latex doc/source doc/build/pdf
  make -C doc/build/pdf

[testenv:releasenotes]
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
  sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
  doc8 doc/source

[testenv:manage]
envdir = {toxworkdir}/venv
commands = {envpython} {toxinidir}/manage.py {posargs}

[testenv:runserver]
envdir = {toxworkdir}/venv
commands =
    {envpython} {toxinidir}/manage.py collectstatic -v 0 -c --noinput
    {envpython} {toxinidir}/manage.py runserver -v 0 {posargs}

[testenv:translations]
envdir = {toxworkdir}/venv
commands =
    {envpython} {toxinidir}/manage.py extract_messages -v 0 --traceback
    {envpython} {toxinidir}/manage.py compilemessages -v 0 --traceback

[testenv:bandit]
envdir = {toxworkdir}/venv
commands = bandit -r horizon openstack_auth openstack_dashboard -n5 -x tests -ll

[testenv:bandit-baseline]
envdir = {toxworkdir}/venv
commands = bandit-baseline -r horizon  openstack_auth openstack_dashboard -n5 -x tests -ii -ll

[flake8]
filename = *.py,django.wsgi
exclude = .git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*,horizon_wsgi.py
# W504 line break after binary operator
# (W503 and W504 are incompatible and we need to choose one of them.
#  Existing codes follows W503, so we disable W504.)
# F405 TEMPLATES may be undefined, or defined from star imports
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
ignore = W504,F405
# Enable the following hacking rules which are disabled by default
# H106 Do not put vim configuration in source files.
# H203 Use assertIs(Not)None to check for None.
# H204 Use assert(Not)Equal to check for equality.
# H205 Use assert(Greater|Less)(Equal) for comparison.
# H904 Delay string interpolations at logging calls.
enable-extensions=H106,H203,H204,H205,H904
max-complexity = 20
max_line_length = 80

# flake8-import-order configurations
import-order-style = pep8
application-import-names = horizon,openstack_dashboard

[flake8:local-plugins]
extension =
  M322 = horizon.hacking.checks:no_mutable_default_args

[doc8]
# File extensions to check
extensions = .rst, .yaml
# Maximal line length should be 80 but we have some overlong lines.
# Let's not get far more in.
max-line-length = 80
# Disable some doc8 checks:
# D000: Check RST validity
# - cannot handle "none" for code-block directive
ignore = D000


[pytest]
markers =
  selenium: Mark for selenium tests
  integration: Mark for integration tests
  plugin_test: Mark for plugin tests
python_files =
  test_*.py
  *_test.py
  tests.py