]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/tox.ini
import ceph quincy 17.2.6
[ceph.git] / ceph / src / pybind / mgr / dashboard / tox.ini
CommitLineData
11fdf7f2 1[tox]
9f95a23c
TL
2envlist =
3 py3,
4 lint,
5 fix,
6 check,
7 run,
522d829b 8 openapi-{check, fix, doc}
11fdf7f2 9skipsdist = true
9f95a23c
TL
10minversion = 2.9.1
11
12[pytest]
13addopts =
14 --cov --cov-append --cov-report=term
15 --doctest-modules
16 --ignore=frontend/ --ignore=module.py
17 --instafail
18
19[base]
20deps =
21 -rrequirements.txt
22 -cconstraints.txt
23
24[base-test]
25deps =
26 -rrequirements-test.txt
27
28[base-lint]
29deps =
30 -rrequirements-lint.txt
11fdf7f2
TL
31
32[testenv]
39ae355f 33basepython=python3
9f95a23c
TL
34deps =
35 {[base]deps}
36 {[base-test]deps}
f67539c2
TL
37 -rrequirements-extra.txt
38passenv =
39 PYTHONPATH
9f95a23c 40setenv =
f67539c2 41 PYTHONPATH=$PYTHONPATH:../..
11fdf7f2 42 CFLAGS = -DXMLSEC_NO_SIZE_T
9f95a23c
TL
43 PYTHONUNBUFFERED=1
44 PYTHONDONTWRITEBYTECODE=1
11fdf7f2
TL
45 UNITTEST = true
46 WEBTEST_INTERACTIVE = false
9f95a23c
TL
47commands =
48 pytest {posargs}
49
50[testenv:run]
9f95a23c
TL
51deps =
52 {[base]deps}
53 {[base-test]deps}
54 {[base-lint]deps}
f67539c2 55allowlist_externals = *
9f95a23c
TL
56commands = {posargs}
57
58[flake8]
59max-line-length = 100
f67539c2 60ignore = E226 E402 W503 F812
9f95a23c
TL
61exclude =
62 .tox,
63 .git,
64 __pycache__,
65 build,
66 dist,
67 *.egg-info,
68 .cache,
69 *.pyc,
70 .eggs,
71 venv,
72 frontend,
73statistics = True
74#TODO: Uncomment and refactor (https://tracker.ceph.com/issues/41221)
75#max-complexity = 10
76format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
77
f67539c2
TL
78[isort]
79atomic = true
80multi_line_output = 2
81line_length = 100
82wrap_length = 80
83
9f95a23c
TL
84[pylint]
85# Allow similarity/code duplication detection
86jobs = 1
f67539c2 87dirs = . api controllers plugins services tests ../../../../qa/tasks/mgr/dashboard
9f95a23c
TL
88addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs}
89
90[rstlint]
91dirs = README.rst HACKING.rst
92
93[base-pylint]
94commands =
95 pylint {[pylint]addopts} {[pylint]dirs}
96
97[base-rst]
98commands =
99 rstcheck --report info --debug -- {[rstlint]dirs}
100
101[testenv:lint]
9f95a23c
TL
102deps =
103 {[base]deps}
104 {[base-lint]deps}
105commands =
106 flake8
f67539c2
TL
107 flake8 --config=tox.ini ../../../../qa/tasks/mgr/dashboard
108 isort . --check
109 isort ../../../../qa/tasks/mgr/dashboard --check
9f95a23c
TL
110 {[base-pylint]commands}
111 {[base-rst]commands}
112
113[testenv:flake8]
9f95a23c
TL
114deps = {[base-lint]deps}
115commands =
116 flake8 --config=tox.ini {posargs}
117
118[testenv:pylint]
9f95a23c
TL
119deps =
120 {[base]deps}
121 {[base-lint]deps}
122commands =
123 pylint {[pylint]addopts} {posargs:{[pylint]dirs}}
124
125[testenv:rst]
9f95a23c
TL
126deps = {[base-lint]deps}
127commands =
128 rstcheck --report info --debug -- {posargs:{[rstlint]dirs}}
129
130[autopep8]
131addopts =
132 --max-line-length {[flake8]max-line-length}
133 --exclude "{[flake8]exclude}"
134 --in-place
135 --recursive
136# TODO: we should progressively increase the level of compliance with PEP8
137# --aggressive
138# --aggressive
139
140[testenv:fix]
9f95a23c
TL
141deps =
142 {[base-lint]deps}
143commands =
144 python --version
145 autopep8 {[autopep8]addopts} {posargs:.}
f67539c2
TL
146 isort .
147 isort ../../../../qa/tasks/mgr/dashboard
9f95a23c
TL
148
149[testenv:check]
9f95a23c 150commands =
20effc67 151 python ci/check_grafana_dashboards.py frontend/src/app ../../../../monitoring/ceph-mixin/dashboards_out
f67539c2
TL
152
153[testenv:openapi-{check,fix}]
f67539c2
TL
154allowlist_externals = diff
155description =
156 check: Ensure that auto-generated OpenAPI Specification matches the current version
157 fix: Update auto-generated OpenAPI Specification with the latest changes
158deps =
159 {[base]deps}
160 {[base-test]deps}
161passenv =
162 PYTHONPATH
163setenv =
164 UNITTEST = true
165 PYTHONPATH=$PYTHONPATH:..:../..
166 OPENAPI_FILE=openapi.yaml
167 check: OPENAPI_FILE_TMP={envtmpdir}/{env:OPENAPI_FILE}
168commands =
169 python3 -m dashboard.controllers.docs {env:OPENAPI_FILE_TMP:{env:OPENAPI_FILE}}
170 check: diff {env:OPENAPI_FILE} {env:OPENAPI_FILE_TMP}
171
172[testenv:openapi-doc]
173description = Generate Sphinx documentation from OpenAPI specification
174deps = -r../../../../admin/doc-requirements.txt
175changedir = ../../../../doc
176commands = sphinx-build -W -b html -c . -D suppress_warnings=ref.* -d {envtmpdir}/doctrees mgr/ceph_api {envtmpdir}/html