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
|
[tox]
envlist =
flake8
mypy
jinjalint
nooptional
check-black
check-isort
py3
skipsdist = true
skip_missing_interpreters = true
[pytest]
log_level=NOTSET
norecursedirs = dashboard rook/rook_client rook/rook-client-python
[base]
deps =
-rrequirements.txt
[pylint]
# Allow similarity/code duplication detection
jobs = 1
addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs}
[flake8]
max-line-length = 100
ignore =
E501,
W503,
exclude =
.tox \
.vagrant \
__pycache__ \
*.pyc \
templates \
.eggs
statistics = True
[autopep8]
addopts =
--max-line-length {[flake8]max-line-length} \
--exclude "{[flake8]exclude}" \
--in-place \
--recursive \
--ignore-local-config
[testenv]
setenv =
UNITTEST = true
PYTHONPATH = $PYTHONPATH:..
deps =
behave
-rrequirements.txt
-rrook/requirements.txt
commands =
pytest --doctest-modules {posargs:}
[testenv:nooptional]
setenv =
UNITTEST = true
PYTHONPATH = $PYTHONPATH:..
deps =
-rrequirements.txt
commands =
pytest {posargs:cephadm/tests/test_ssh.py}
[testenv:{,py37-,py38-,py39-,py310-}mypy]
setenv =
MYPYPATH = {toxinidir}/..:{toxinidir}/../../python-common
passenv =
MYPYPATH
deps =
-rrequirements.txt
-c{toxinidir}/../../mypy-constrains.txt
mypy
types-backports
types-pkg_resources
types-python-dateutil
types-requests
types-PyYAML
types-jwt
commands =
mypy --config-file=../../mypy.ini \
-m alerts \
-m balancer \
-m cephadm \
-m crash \
-m dashboard \
-m devicehealth \
-m diskprediction_local \
-m hello \
-m influx \
-m iostat \
-m localpool \
-m mds_autoscaler \
-m mgr_module \
-m mgr_util \
-m mirroring \
-m nfs \
-m orchestrator \
-m pg_autoscaler \
-m progress \
-m prometheus \
-m rbd_support \
-m rgw \
-m rook \
-m selftest \
-m smb \
-m snap_schedule \
-m stats \
-m status \
-m telegraf \
-m telemetry \
-m test_orchestrator \
-m volumes
[testenv:test]
setenv = {[testenv]setenv}
deps = {[testenv]deps}
commands = {[testenv]commands}
[testenv:pylint]
deps =
pylint
modules =
cli_api
commands =
pylint {[pylint]addopts} {posargs:{[testenv:pylint]modules}}
[testenv:flake8]
deps =
flake8
allowlist_externals = bash
modules =
alerts \
balancer \
cephadm \
cli_api \
crash \
devicehealth \
diskprediction_local \
hello \
iostat \
localpool \
mgr_module.py \
mgr_util.py \
nfs \
object_format.py \
orchestrator \
prometheus \
rbd_support \
rgw \
selftest \
smb
commands =
flake8 --config=tox.ini {posargs} \
{posargs:{[testenv:flake8]modules}}
bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "docker.io" | wc -l) == 3'
bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "quay.io" | wc -l) == 8'
[testenv:jinjalint]
deps =
jinjaninja
commands =
jinja-ninja cephadm/templates
# OPT-IN formatting with 'black'
# add your module to the modules list below to use automated formatting
[black]
deps = black>=23,<24
options = -l78 -t py36 --skip-string-normalization
modules = smb
[testenv:check-black]
deps = {[black]deps}
commands =
black --check -q {[black]options} {[black]modules}
[testenv:format-black]
deps = {[black]deps}
commands =
black {[black]options} {[black]modules}
# OPT-IN import style formatting with 'isort'
# add your module to the modules list below to use automated import sorting
[isortcfg]
deps = isort
modules = smb
[isort]
profile = black
line_length = 78
known_first_party = ceph,rados,rbd,cephfs,mgr,mgr_module,mgr_util,object_format
known_typing = typing
sections = FUTURE,TYPING,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
[testenv:check-isort]
deps = {[isortcfg]deps}
commands =
isort --check-only {[isortcfg]modules}
[testenv:format-isort]
deps = {[isortcfg]deps}
commands =
isort {[isortcfg]modules}
|