]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/tox.ini
bump version to 17.2.5-pve1
[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]
9f95a23c
TL
33deps =
34 {[base]deps}
35 {[base-test]deps}
f67539c2
TL
36 -rrequirements-extra.txt
37passenv =
38 PYTHONPATH
9f95a23c 39setenv =
f67539c2 40 PYTHONPATH=$PYTHONPATH:../..
11fdf7f2 41 CFLAGS = -DXMLSEC_NO_SIZE_T
9f95a23c
TL
42 PYTHONUNBUFFERED=1
43 PYTHONDONTWRITEBYTECODE=1
11fdf7f2
TL
44 UNITTEST = true
45 WEBTEST_INTERACTIVE = false
9f95a23c
TL
46commands =
47 pytest {posargs}
48
49[testenv:run]
50basepython=python3
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]
102basepython=python3
103deps =
104 {[base]deps}
105 {[base-lint]deps}
106commands =
107 flake8
f67539c2
TL
108 flake8 --config=tox.ini ../../../../qa/tasks/mgr/dashboard
109 isort . --check
110 isort ../../../../qa/tasks/mgr/dashboard --check
9f95a23c
TL
111 {[base-pylint]commands}
112 {[base-rst]commands}
113
114[testenv:flake8]
115basepython = python3
116deps = {[base-lint]deps}
117commands =
118 flake8 --config=tox.ini {posargs}
119
120[testenv:pylint]
121basepython = python3
122deps =
123 {[base]deps}
124 {[base-lint]deps}
125commands =
126 pylint {[pylint]addopts} {posargs:{[pylint]dirs}}
127
128[testenv:rst]
129basepython = python3
130deps = {[base-lint]deps}
131commands =
132 rstcheck --report info --debug -- {posargs:{[rstlint]dirs}}
133
134[autopep8]
135addopts =
136 --max-line-length {[flake8]max-line-length}
137 --exclude "{[flake8]exclude}"
138 --in-place
139 --recursive
140# TODO: we should progressively increase the level of compliance with PEP8
141# --aggressive
142# --aggressive
143
144[testenv:fix]
145basepython=python3
146deps =
147 {[base-lint]deps}
148commands =
149 python --version
150 autopep8 {[autopep8]addopts} {posargs:.}
f67539c2
TL
151 isort .
152 isort ../../../../qa/tasks/mgr/dashboard
9f95a23c
TL
153
154[testenv:check]
9f95a23c 155commands =
20effc67 156 python ci/check_grafana_dashboards.py frontend/src/app ../../../../monitoring/ceph-mixin/dashboards_out
f67539c2
TL
157
158[testenv:openapi-{check,fix}]
159basepython = python3
160allowlist_externals = diff
161description =
162 check: Ensure that auto-generated OpenAPI Specification matches the current version
163 fix: Update auto-generated OpenAPI Specification with the latest changes
164deps =
165 {[base]deps}
166 {[base-test]deps}
167passenv =
168 PYTHONPATH
169setenv =
170 UNITTEST = true
171 PYTHONPATH=$PYTHONPATH:..:../..
172 OPENAPI_FILE=openapi.yaml
173 check: OPENAPI_FILE_TMP={envtmpdir}/{env:OPENAPI_FILE}
174commands =
175 python3 -m dashboard.controllers.docs {env:OPENAPI_FILE_TMP:{env:OPENAPI_FILE}}
176 check: diff {env:OPENAPI_FILE} {env:OPENAPI_FILE_TMP}
177
178[testenv:openapi-doc]
179description = Generate Sphinx documentation from OpenAPI specification
180deps = -r../../../../admin/doc-requirements.txt
181changedir = ../../../../doc
182commands = sphinx-build -W -b html -c . -D suppress_warnings=ref.* -d {envtmpdir}/doctrees mgr/ceph_api {envtmpdir}/html