]>
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] | |
39ae355f | 33 | basepython=python3 |
9f95a23c TL |
34 | deps = |
35 | {[base]deps} | |
36 | {[base-test]deps} | |
f67539c2 TL |
37 | -rrequirements-extra.txt |
38 | passenv = | |
39 | PYTHONPATH | |
9f95a23c | 40 | setenv = |
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 |
47 | commands = |
48 | pytest {posargs} | |
49 | ||
50 | [testenv:run] | |
9f95a23c TL |
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] | |
9f95a23c TL |
102 | deps = |
103 | {[base]deps} | |
104 | {[base-lint]deps} | |
105 | commands = | |
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 |
114 | deps = {[base-lint]deps} |
115 | commands = | |
116 | flake8 --config=tox.ini {posargs} | |
117 | ||
118 | [testenv:pylint] | |
9f95a23c TL |
119 | deps = |
120 | {[base]deps} | |
121 | {[base-lint]deps} | |
122 | commands = | |
123 | pylint {[pylint]addopts} {posargs:{[pylint]dirs}} | |
124 | ||
125 | [testenv:rst] | |
9f95a23c TL |
126 | deps = {[base-lint]deps} |
127 | commands = | |
128 | rstcheck --report info --debug -- {posargs:{[rstlint]dirs}} | |
129 | ||
130 | [autopep8] | |
131 | addopts = | |
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 |
141 | deps = |
142 | {[base-lint]deps} | |
143 | commands = | |
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 | 150 | commands = |
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 |
154 | allowlist_externals = diff |
155 | description = | |
156 | check: Ensure that auto-generated OpenAPI Specification matches the current version | |
157 | fix: Update auto-generated OpenAPI Specification with the latest changes | |
158 | deps = | |
159 | {[base]deps} | |
160 | {[base-test]deps} | |
161 | passenv = | |
162 | PYTHONPATH | |
163 | setenv = | |
164 | UNITTEST = true | |
165 | PYTHONPATH=$PYTHONPATH:..:../.. | |
166 | OPENAPI_FILE=openapi.yaml | |
167 | check: OPENAPI_FILE_TMP={envtmpdir}/{env:OPENAPI_FILE} | |
168 | commands = | |
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] | |
173 | description = Generate Sphinx documentation from OpenAPI specification | |
174 | deps = -r../../../../admin/doc-requirements.txt | |
175 | changedir = ../../../../doc | |
176 | commands = sphinx-build -W -b html -c . -D suppress_warnings=ref.* -d {envtmpdir}/doctrees mgr/ceph_api {envtmpdir}/html |