]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | [tox] |
9f95a23c TL |
2 | envlist = |
3 | py3, | |
4 | lint, | |
5 | fix, | |
6 | check, | |
7 | run, | |
522d829b | 8 | openapi-{check, fix, doc} |
11fdf7f2 | 9 | skipsdist = true |
9f95a23c TL |
10 | minversion = 2.9.1 |
11 | ||
12 | [pytest] | |
13 | addopts = | |
14 | --cov --cov-append --cov-report=term | |
15 | --doctest-modules | |
16 | --ignore=frontend/ --ignore=module.py | |
17 | --instafail | |
18 | ||
19 | [base] | |
20 | deps = | |
21 | -rrequirements.txt | |
22 | -cconstraints.txt | |
23 | ||
24 | [base-test] | |
25 | deps = | |
26 | -rrequirements-test.txt | |
27 | ||
28 | [base-lint] | |
29 | deps = | |
30 | -rrequirements-lint.txt | |
11fdf7f2 TL |
31 | |
32 | [testenv] | |
9f95a23c TL |
33 | deps = |
34 | {[base]deps} | |
35 | {[base-test]deps} | |
f67539c2 TL |
36 | -rrequirements-extra.txt |
37 | passenv = | |
38 | PYTHONPATH | |
9f95a23c | 39 | setenv = |
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 |
46 | commands = |
47 | pytest {posargs} | |
48 | ||
49 | [testenv:run] | |
50 | basepython=python3 | |
51 | deps = | |
52 | {[base]deps} | |
53 | {[base-test]deps} | |
54 | {[base-lint]deps} | |
f67539c2 | 55 | allowlist_externals = * |
9f95a23c TL |
56 | commands = {posargs} |
57 | ||
58 | [flake8] | |
59 | max-line-length = 100 | |
f67539c2 | 60 | ignore = E226 E402 W503 F812 |
9f95a23c TL |
61 | exclude = |
62 | .tox, | |
63 | .git, | |
64 | __pycache__, | |
65 | build, | |
66 | dist, | |
67 | *.egg-info, | |
68 | .cache, | |
69 | *.pyc, | |
70 | .eggs, | |
71 | venv, | |
72 | frontend, | |
73 | statistics = True | |
74 | #TODO: Uncomment and refactor (https://tracker.ceph.com/issues/41221) | |
75 | #max-complexity = 10 | |
76 | format = ${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] |
79 | atomic = true | |
80 | multi_line_output = 2 | |
81 | line_length = 100 | |
82 | wrap_length = 80 | |
83 | ||
9f95a23c TL |
84 | [pylint] |
85 | # Allow similarity/code duplication detection | |
86 | jobs = 1 | |
f67539c2 | 87 | dirs = . api controllers plugins services tests ../../../../qa/tasks/mgr/dashboard |
9f95a23c TL |
88 | addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs} |
89 | ||
90 | [rstlint] | |
91 | dirs = README.rst HACKING.rst | |
92 | ||
93 | [base-pylint] | |
94 | commands = | |
95 | pylint {[pylint]addopts} {[pylint]dirs} | |
96 | ||
97 | [base-rst] | |
98 | commands = | |
99 | rstcheck --report info --debug -- {[rstlint]dirs} | |
100 | ||
101 | [testenv:lint] | |
102 | basepython=python3 | |
103 | deps = | |
104 | {[base]deps} | |
105 | {[base-lint]deps} | |
106 | commands = | |
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] | |
115 | basepython = python3 | |
116 | deps = {[base-lint]deps} | |
117 | commands = | |
118 | flake8 --config=tox.ini {posargs} | |
119 | ||
120 | [testenv:pylint] | |
121 | basepython = python3 | |
122 | deps = | |
123 | {[base]deps} | |
124 | {[base-lint]deps} | |
125 | commands = | |
126 | pylint {[pylint]addopts} {posargs:{[pylint]dirs}} | |
127 | ||
128 | [testenv:rst] | |
129 | basepython = python3 | |
130 | deps = {[base-lint]deps} | |
131 | commands = | |
132 | rstcheck --report info --debug -- {posargs:{[rstlint]dirs}} | |
133 | ||
134 | [autopep8] | |
135 | addopts = | |
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] | |
145 | basepython=python3 | |
146 | deps = | |
147 | {[base-lint]deps} | |
148 | commands = | |
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 | 155 | commands = |
20effc67 | 156 | python ci/check_grafana_dashboards.py frontend/src/app ../../../../monitoring/ceph-mixin/dashboards_out |
f67539c2 TL |
157 | |
158 | [testenv:openapi-{check,fix}] | |
159 | basepython = python3 | |
160 | allowlist_externals = diff | |
161 | description = | |
162 | check: Ensure that auto-generated OpenAPI Specification matches the current version | |
163 | fix: Update auto-generated OpenAPI Specification with the latest changes | |
164 | deps = | |
165 | {[base]deps} | |
166 | {[base-test]deps} | |
167 | passenv = | |
168 | PYTHONPATH | |
169 | setenv = | |
170 | UNITTEST = true | |
171 | PYTHONPATH=$PYTHONPATH:..:../.. | |
172 | OPENAPI_FILE=openapi.yaml | |
173 | check: OPENAPI_FILE_TMP={envtmpdir}/{env:OPENAPI_FILE} | |
174 | commands = | |
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] | |
179 | description = Generate Sphinx documentation from OpenAPI specification | |
180 | deps = -r../../../../admin/doc-requirements.txt | |
181 | changedir = ../../../../doc | |
182 | commands = sphinx-build -W -b html -c . -D suppress_warnings=ref.* -d {envtmpdir}/doctrees mgr/ceph_api {envtmpdir}/html |