Merge ~peppepetra/+git/makefile_spec:makefile_spec into ~peppepetra/+git/makefile_spec:master
- Git
- lp:~peppepetra/+git/makefile_spec
- makefile_spec
- Merge into master
Status: | Needs review |
---|---|
Proposed branch: | ~peppepetra/+git/makefile_spec:makefile_spec |
Merge into: | ~peppepetra/+git/makefile_spec:master |
Diff against target: |
581 lines (+510/-0) 9 files modified
.gitignore (+6/-0) .jujuignore (+1/-0) Makefile.non_reactive (+75/-0) Makefile.operator (+78/-0) Makefile.reactive (+80/-0) tox.ini_unitpytest_funcpytest (+70/-0) tox.ini_unitpytest_funczaza (+71/-0) tox.ini_unitunittest_funcpytest (+64/-0) tox.ini_unitunittest_funczaza (+65/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Goins (community) | Needs Fixing | ||
Drew Freiberger (community) | Needs Fixing | ||
Giuseppe Petralia | Pending | ||
Review via email: mp+387599@code.launchpad.net |
Commit message
Description of the change
- 0035343... by Giuseppe Petralia
-
Simplify clean target and make build dependant on submodules
Drew Freiberger (afreiberger) wrote : | # |
Added comments per our discussion with Jeremy this morning.
- 1544aa1... by Giuseppe Petralia
-
Change default values for build, interfaces and layers path
Update max-length-line to 88 (black default)
Xav Paice (xavpaice) wrote : | # |
Few comments on the exclusions, maybe using .builds rather than 'build', though if it's a regex it'll probably cover the exclusion as is.
I'd be keen to see the clean remove any pyc files from the entire tree, as these often find their way into builds when we're using cp to make them and that'll cause all manner of weird failures in production.
- 66b6a02... by Giuseppe Petralia
-
Update coverage to exclude .builds/
Drew Freiberger (afreiberger) wrote : | # |
minor nit on build step cp command.
- e737933... by Giuseppe Petralia
-
Ignore charm proof errors raised for non reactive charms.
Use cp -a for non reactive charms when copying to build dir.
Remove dependency on submodules target for release target for operator Makefile. - 82d1917... by Giuseppe Petralia
-
Update git submodule cmd to pull latest updates.
- 8f40cc6... by Giuseppe Petralia
-
Exclude .builds from flake8 checks.
- f5964df... by Giuseppe Petralia
-
Remove build dependency on submodules target.
Avoid pulling latest updates where running "make submodules" and
stick with versions set on .gitsubmodules. - c1397a8... by Giuseppe Petralia
-
Add submodules-update target.
- 044788f... by Giuseppe Petralia
-
Update build dir to .build.
Not override CHARM_BUILD_DIR if defined by the user.
Paul Goins (vultaire) wrote : | # |
There's some small diff comments for stuff that actually should be changed...
And then there's some larger comments to reflect recent discussion re: a few issues. I tried my best to represent the different points of view expressed.
Discussion desired, but be careful; this could easily devolve into bikeshedding. I'd like for opinions to be expressed, but ultimately we may just need a decision made for the sake of moving forward.
Chris Sanders (chris.sanders) wrote : | # |
Be aware Openstack is not the only team we run infrastructure for anymore. K8s charms are increasingly common and they do not follow the Openstack naming conventions they use tox + pytest I believe with other test libraries. It's possible there is a convention from the Charmcraft team we could adopt?
I wouldn't put a lot of time/effort into trying to match every other team as long as we pick something and stick to it. There are several comments/
I don't want anyone to take that to mean 'leave it as it is' simply let's be mindful the amount of time we put into things based on the value they will bring.
Paul Goins (vultaire) wrote : | # |
Added a few comments re: the discussion.
- 095618c... by Giuseppe Petralia
-
Address reviews comments
Giuseppe Petralia (peppepetra) wrote : | # |
Replied inline to comments
- 69dd487... by Giuseppe Petralia
-
Add support for src folder for reactive charms.
- 56290ad... by Giuseppe Petralia
-
Update report folder to match gitignore
Paul Goins (vultaire) wrote : | # |
More suggestions, re: "make clean" specifically. It likely affects all the Makefiles, but I just commented once.
Paul Goins (vultaire) : | # |
Paul Goins (vultaire) : | # |
Paul Goins (vultaire) wrote : | # |
Found another bit which I think ought to be changed.
Paul Goins (vultaire) : | # |
- b1b36f6... by Giuseppe Petralia
-
Exclude .idea from git clean
Add black reformat target
Add repo-info and version files creation.
Alvaro Uria (aluria) wrote : | # |
Overall, it lgtm. However, I've added a question about using "git clean" passing "-f" twice instead of once.
- 78dd92e... by Giuseppe Petralia
-
Add juju cookies file to gitignore.
Paul Goins (vultaire) wrote : | # |
I think this needs to be fixed; I encountered this on a charm which was being ported from nosetests to unittest discover.
- f5832bf... by Giuseppe Petralia
-
Run charm proof on build.
Unmerged commits
- f5832bf... by Giuseppe Petralia
-
Run charm proof on build.
- 78dd92e... by Giuseppe Petralia
-
Add juju cookies file to gitignore.
- b1b36f6... by Giuseppe Petralia
-
Exclude .idea from git clean
Add black reformat target
Add repo-info and version files creation. - 56290ad... by Giuseppe Petralia
-
Update report folder to match gitignore
- 69dd487... by Giuseppe Petralia
-
Add support for src folder for reactive charms.
- 095618c... by Giuseppe Petralia
-
Address reviews comments
- 044788f... by Giuseppe Petralia
-
Update build dir to .build.
Not override CHARM_BUILD_DIR if defined by the user. - c1397a8... by Giuseppe Petralia
-
Add submodules-update target.
- f5964df... by Giuseppe Petralia
-
Remove build dependency on submodules target.
Avoid pulling latest updates where running "make submodules" and
stick with versions set on .gitsubmodules. - 8f40cc6... by Giuseppe Petralia
-
Exclude .builds from flake8 checks.
Preview Diff
1 | diff --git a/.gitignore b/.gitignore |
2 | index e1bb8bf..6f1f367 100644 |
3 | --- a/.gitignore |
4 | +++ b/.gitignore |
5 | @@ -1,5 +1,7 @@ |
6 | # Juju files |
7 | .unit-state.db |
8 | +.go-cookies |
9 | + |
10 | layers/* |
11 | interfaces/* |
12 | |
13 | @@ -26,6 +28,7 @@ htmlcov/ |
14 | |
15 | # version data |
16 | repo-info |
17 | +version |
18 | |
19 | # Python builds |
20 | deb_dist/ |
21 | @@ -33,3 +36,6 @@ dist/ |
22 | |
23 | # Snaps |
24 | *.snap |
25 | + |
26 | +# Builds |
27 | +.build/ |
28 | \ No newline at end of file |
29 | diff --git a/.jujuignore b/.jujuignore |
30 | new file mode 100644 |
31 | index 0000000..b7f1399 |
32 | --- /dev/null |
33 | +++ b/.jujuignore |
34 | @@ -0,0 +1 @@ |
35 | +.build |
36 | \ No newline at end of file |
37 | diff --git a/Makefile.non_reactive b/Makefile.non_reactive |
38 | new file mode 100644 |
39 | index 0000000..7e1e684 |
40 | --- /dev/null |
41 | +++ b/Makefile.non_reactive |
42 | @@ -0,0 +1,75 @@ |
43 | +PYTHON := /usr/bin/python3 |
44 | + |
45 | +PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST))) |
46 | +ifndef CHARM_BUILD_DIR |
47 | + CHARM_BUILD_DIR=${PROJECTPATH}.build |
48 | +endif |
49 | +METADATA_FILE="metadata.yaml" |
50 | +CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}') |
51 | + |
52 | +help: |
53 | + @echo "This project supports the following targets" |
54 | + @echo "" |
55 | + @echo " make help - show this text" |
56 | + @echo " make clean - remove unneeded files" |
57 | + @echo " make submodules - make sure that the submodules are up-to-date" |
58 | + @echo " make submodules-update - update submodules to latest changes on remote branch" |
59 | + @echo " make build - build the charm" |
60 | + @echo " make release - run clean and build targets" |
61 | + @echo " make lint - run flake8 and black --check" |
62 | + @echo " make black - run black and reformat files" |
63 | + @echo " make proof - run charm proof" |
64 | + @echo " make unittests - run the tests defined in the unittest subdirectory" |
65 | + @echo " make functional - run the tests defined in the functional subdirectory" |
66 | + @echo " make test - run lint, proof, unittests and functional targets" |
67 | + @echo "" |
68 | + |
69 | +clean: |
70 | + @echo "Cleaning files" |
71 | + @git clean -ffXd -e '!.idea' |
72 | + @echo "Cleaning existing build" |
73 | + @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME} |
74 | + |
75 | +submodules: |
76 | + @echo "Cloning submodules" |
77 | + @git submodule update --init --recursive |
78 | + |
79 | +submodules-update: |
80 | + @echo "Pulling latest updates for submodules" |
81 | + @git submodule update --init --recursive --remote --merge |
82 | + |
83 | +build: |
84 | + @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
85 | + @-git rev-parse --abbrev-ref HEAD > ./repo-info |
86 | + @-git describe --always > ./version |
87 | + @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME} |
88 | + @cp -a ./* ${CHARM_BUILD_DIR}/${CHARM_NAME} |
89 | + |
90 | +release: clean build |
91 | + @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
92 | + |
93 | +lint: |
94 | + @echo "Running lint checks" |
95 | + @tox -e lint |
96 | + |
97 | +black: |
98 | + @echo "Reformat files with black" |
99 | + @tox -e black |
100 | + |
101 | +proof: |
102 | + @echo "Running charm proof" |
103 | + @-charm proof |
104 | + |
105 | +unittests: |
106 | + @echo "Running unit tests" |
107 | + @tox -e unit |
108 | + |
109 | +functional: build |
110 | + @echo "Executing functional tests in ${CHARM_BUILD_DIR}" |
111 | + @CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func |
112 | + |
113 | +test: lint proof unittests functional |
114 | + @echo "Charm ${CHARM_NAME} has been tested" |
115 | + |
116 | +# The targets below don't depend on a file |
117 | +.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test |
118 | diff --git a/Makefile.operator b/Makefile.operator |
119 | new file mode 100644 |
120 | index 0000000..92ded5f |
121 | --- /dev/null |
122 | +++ b/Makefile.operator |
123 | @@ -0,0 +1,78 @@ |
124 | +PYTHON := /usr/bin/python3 |
125 | + |
126 | +PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST))) |
127 | +ifndef CHARM_BUILD_DIR |
128 | + CHARM_BUILD_DIR=${PROJECTPATH}.build |
129 | +endif |
130 | +METADATA_FILE="metadata.yaml" |
131 | +CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}') |
132 | + |
133 | +help: |
134 | + @echo "This project supports the following targets" |
135 | + @echo "" |
136 | + @echo " make help - show this text" |
137 | + @echo " make clean - remove unneeded files" |
138 | + @echo " make submodules - make sure that the submodules are up-to-date" |
139 | + @echo " make submodules-update - update submodules to latest changes on remote branch" |
140 | + @echo " make build - build the charm" |
141 | + @echo " make release - run clean, submodules and build targets" |
142 | + @echo " make lint - run flake8 and black --check" |
143 | + @echo " make black - run black and reformat files" |
144 | + @echo " make proof - run charm proof" |
145 | + @echo " make unittests - run the tests defined in the unittest subdirectory" |
146 | + @echo " make functional - run the tests defined in the functional subdirectory" |
147 | + @echo " make test - run lint, proof, unittests and functional targets" |
148 | + @echo "" |
149 | + |
150 | +clean: |
151 | + @echo "Cleaning files" |
152 | + @git clean -ffXd -e '!.idea' |
153 | + @echo "Cleaning existing build" |
154 | + @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME} |
155 | + |
156 | +submodules: |
157 | + @echo "Cloning submodules" |
158 | + @git submodule update --init --recursive |
159 | + |
160 | +submodules-update: |
161 | + @echo "Pulling latest updates for submodules" |
162 | + @git submodule update --init --recursive --remote --merge |
163 | + |
164 | +build: |
165 | + @echo "Building charm to base directory ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
166 | + @-git rev-parse --abbrev-ref HEAD > ./repo-info |
167 | + @-git describe --always > ./version |
168 | + @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME} |
169 | + @cp -a ./* ${CHARM_BUILD_DIR}/${CHARM_NAME} |
170 | + @echo "Installing/updating env if requirements.txt exists" |
171 | + @mkdir -p ${CHARM_BUILD_DIR}/${CHARM_NAME}/env/ |
172 | + @if [ -f requirements.txt ] ; then pip3 install --target=${CHARM_BUILD_DIR}/${CHARM_NAME}/env -r requirements.txt --upgrade ; fi |
173 | + |
174 | +release: clean build |
175 | + @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
176 | + |
177 | +lint: |
178 | + @echo "Running lint checks" |
179 | + @tox -e lint |
180 | + |
181 | +black: |
182 | + @echo "Reformat files with black" |
183 | + @tox -e black |
184 | + |
185 | +proof: |
186 | + @echo "Running charm proof" |
187 | + @-charm proof |
188 | + |
189 | +unittests: |
190 | + @echo "Running unit tests" |
191 | + @tox -e unit |
192 | + |
193 | +functional: build |
194 | + @echo "Executing functional tests in ${CHARM_BUILD_DIR}" |
195 | + @CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func |
196 | + |
197 | +test: lint proof unittests functional |
198 | + @echo "Tests completed for charm ${CHARM_NAME}." |
199 | + |
200 | +# The targets below don't depend on a file |
201 | +.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test |
202 | diff --git a/Makefile.reactive b/Makefile.reactive |
203 | new file mode 100644 |
204 | index 0000000..5416279 |
205 | --- /dev/null |
206 | +++ b/Makefile.reactive |
207 | @@ -0,0 +1,80 @@ |
208 | +PYTHON := /usr/bin/python3 |
209 | + |
210 | +PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST))) |
211 | +ifndef CHARM_BUILD_DIR |
212 | + CHARM_BUILD_DIR=${PROJECTPATH}.build |
213 | +endif |
214 | +ifndef CHARM_LAYERS_DIR |
215 | + CHARM_LAYERS_DIR=${PROJECTPATH}/layers |
216 | +endif |
217 | +ifndef CHARM_INTERFACES_DIR |
218 | + CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces |
219 | +endif |
220 | +METADATA_FILE="src/metadata.yaml" |
221 | +CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}') |
222 | + |
223 | +help: |
224 | + @echo "This project supports the following targets" |
225 | + @echo "" |
226 | + @echo " make help - show this text" |
227 | + @echo " make clean - remove unneeded files" |
228 | + @echo " make submodules - make sure that the submodules are up-to-date" |
229 | + @echo " make submodules-update - update submodules to latest changes on remote branch" |
230 | + @echo " make build - build the charm" |
231 | + @echo " make release - run clean, submodules, and build targets" |
232 | + @echo " make lint - run flake8 and black --check" |
233 | + @echo " make black - run black and reformat files" |
234 | + @echo " make proof - run charm proof" |
235 | + @echo " make unittests - run the tests defined in the unittest subdirectory" |
236 | + @echo " make functional - run the tests defined in the functional subdirectory" |
237 | + @echo " make test - run lint, proof, unittests and functional targets" |
238 | + @echo "" |
239 | + |
240 | +clean: |
241 | + @echo "Cleaning files" |
242 | + @git clean -ffXd -e '!.idea' |
243 | + @echo "Cleaning existing build" |
244 | + @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME} |
245 | + |
246 | +submodules: |
247 | + @echo "Cloning submodules" |
248 | + @git submodule update --init --recursive |
249 | + |
250 | +submodules-update: |
251 | + @echo "Pulling latest updates for submodules" |
252 | + @git submodule update --init --recursive --remote --merge |
253 | + |
254 | +build: |
255 | + @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
256 | + @-git rev-parse --abbrev-ref HEAD > ./src/repo-info |
257 | + @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \ |
258 | + TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/ |
259 | + |
260 | +release: clean build |
261 | + @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
262 | + |
263 | +lint: |
264 | + @echo "Running lint checks" |
265 | + @cd src && tox -e lint |
266 | + |
267 | +black: |
268 | + @echo "Reformat files with black" |
269 | + @cd src && tox -e black |
270 | + |
271 | +proof: build |
272 | + @echo "Running charm proof" |
273 | + @charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME} |
274 | + |
275 | +unittests: |
276 | + @echo "Running unit tests" |
277 | + @cd src && tox -e unit |
278 | + |
279 | +functional: build |
280 | + @echo "Executing functional tests in ${CHARM_BUILD_DIR}" |
281 | + @cd src && CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func |
282 | + |
283 | +test: lint proof unittests functional |
284 | + @echo "Tests completed for charm ${CHARM_NAME}." |
285 | + |
286 | +# The targets below don't depend on a file |
287 | +.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test |
288 | diff --git a/tox.ini_unitpytest_funcpytest b/tox.ini_unitpytest_funcpytest |
289 | new file mode 100644 |
290 | index 0000000..2900ead |
291 | --- /dev/null |
292 | +++ b/tox.ini_unitpytest_funcpytest |
293 | @@ -0,0 +1,70 @@ |
294 | +[tox] |
295 | +skipsdist=True |
296 | +skip_missing_interpreters = True |
297 | +envlist = lint, unit, func |
298 | + |
299 | +[testenv] |
300 | +basepython = python3 |
301 | +setenv = |
302 | + PYTHONPATH = {toxinidir}:{toxinidir}/lib/:{toxinidir}/hooks/ |
303 | +passenv = |
304 | + HOME |
305 | + PATH |
306 | + CHARM_BUILD_DIR |
307 | + PYTEST_KEEP_MODEL |
308 | + PYTEST_CLOUD_NAME |
309 | + PYTEST_CLOUD_REGION |
310 | + PYTEST_MODEL |
311 | + MODEL_SETTINGS |
312 | + HTTP_PROXY |
313 | + HTTPS_PROXY |
314 | + NO_PROXY |
315 | + SNAP_HTTP_PROXY |
316 | + SNAP_HTTPS_PROXY |
317 | + |
318 | +[testenv:lint] |
319 | +commands = |
320 | + flake8 |
321 | + black --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
322 | +deps = |
323 | + black |
324 | + flake8 |
325 | + flake8-docstrings |
326 | + flake8-import-order |
327 | + pep8-naming |
328 | + flake8-colors |
329 | + |
330 | +[flake8] |
331 | +exclude = |
332 | + .git, |
333 | + __pycache__, |
334 | + .tox, |
335 | + charmhelpers, |
336 | + mod, |
337 | + .build |
338 | + |
339 | +max-line-length = 88 |
340 | +max-complexity = 10 |
341 | + |
342 | +[testenv:black] |
343 | +commands = |
344 | + black --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
345 | +deps = |
346 | + black |
347 | + |
348 | +[testenv:unit] |
349 | +commands = |
350 | + pytest -v --ignore {toxinidir}/tests/functional \ |
351 | + --cov=lib \ |
352 | + --cov=reactive \ |
353 | + --cov=actions \ |
354 | + --cov=hooks \ |
355 | + --cov=src \ |
356 | + --cov-report=term \ |
357 | + --cov-report=annotate:report/annotated \ |
358 | + --cov-report=html:report/html |
359 | +deps = -r{toxinidir}/tests/unit/requirements.txt |
360 | + |
361 | +[testenv:func] |
362 | +commands = pytest -v --ignore {toxinidir}/tests/unit |
363 | +deps = -r{toxinidir}/tests/functional/requirements.txt |
364 | diff --git a/tox.ini_unitpytest_funczaza b/tox.ini_unitpytest_funczaza |
365 | new file mode 100644 |
366 | index 0000000..24fb13b |
367 | --- /dev/null |
368 | +++ b/tox.ini_unitpytest_funczaza |
369 | @@ -0,0 +1,71 @@ |
370 | +[tox] |
371 | +skipsdist=True |
372 | +skip_missing_interpreters = True |
373 | +envlist = lint, unit, func |
374 | + |
375 | +[testenv] |
376 | +basepython = python3 |
377 | +setenv = |
378 | + PYTHONPATH = {toxinidir}:{toxinidir}/lib/:{toxinidir}/hooks/ |
379 | +passenv = |
380 | + HOME |
381 | + PATH |
382 | + CHARM_BUILD_DIR |
383 | + PYTEST_KEEP_MODEL |
384 | + PYTEST_CLOUD_NAME |
385 | + PYTEST_CLOUD_REGION |
386 | + PYTEST_MODEL |
387 | + MODEL_SETTINGS |
388 | + HTTP_PROXY |
389 | + HTTPS_PROXY |
390 | + NO_PROXY |
391 | + SNAP_HTTP_PROXY |
392 | + SNAP_HTTPS_PROXY |
393 | + |
394 | +[testenv:lint] |
395 | +commands = |
396 | + flake8 |
397 | + black --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
398 | +deps = |
399 | + black |
400 | + flake8 |
401 | + flake8-docstrings |
402 | + flake8-import-order |
403 | + pep8-naming |
404 | + flake8-colors |
405 | + |
406 | +[flake8] |
407 | +exclude = |
408 | + .git, |
409 | + __pycache__, |
410 | + .tox, |
411 | + charmhelpers, |
412 | + mod, |
413 | + .build |
414 | + |
415 | +max-line-length = 88 |
416 | +max-complexity = 10 |
417 | + |
418 | +[testenv:black] |
419 | +commands = |
420 | + black --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
421 | +deps = |
422 | + black |
423 | + |
424 | +[testenv:unit] |
425 | +commands = |
426 | + pytest -v --ignore {toxinidir}/tests/functional \ |
427 | + --cov=lib \ |
428 | + --cov=reactive \ |
429 | + --cov=actions \ |
430 | + --cov=hooks \ |
431 | + --cov=src \ |
432 | + --cov-report=term \ |
433 | + --cov-report=annotate:report/annotated \ |
434 | + --cov-report=html:report/html |
435 | +deps = -r{toxinidir}/tests/unit/requirements.txt |
436 | + |
437 | +[testenv:func] |
438 | +changedir = {toxinidir}/tests/functional |
439 | +commands = functest-run-suite {posargs} |
440 | +deps = -r{toxinidir}/tests/functional/requirements.txt |
441 | diff --git a/tox.ini_unitunittest_funcpytest b/tox.ini_unitunittest_funcpytest |
442 | new file mode 100644 |
443 | index 0000000..cbd4612 |
444 | --- /dev/null |
445 | +++ b/tox.ini_unitunittest_funcpytest |
446 | @@ -0,0 +1,64 @@ |
447 | +[tox] |
448 | +skipsdist=True |
449 | +skip_missing_interpreters = True |
450 | +envlist = lint, unit, func |
451 | + |
452 | +[testenv] |
453 | +basepython = python3 |
454 | +setenv = |
455 | + PYTHONPATH = {toxinidir}:{toxinidir}/lib/:{toxinidir}/hooks/ |
456 | +passenv = |
457 | + HOME |
458 | + PATH |
459 | + CHARM_BUILD_DIR |
460 | + PYTEST_KEEP_MODEL |
461 | + PYTEST_CLOUD_NAME |
462 | + PYTEST_CLOUD_REGION |
463 | + PYTEST_MODEL |
464 | + MODEL_SETTINGS |
465 | + HTTP_PROXY |
466 | + HTTPS_PROXY |
467 | + NO_PROXY |
468 | + SNAP_HTTP_PROXY |
469 | + SNAP_HTTPS_PROXY |
470 | + |
471 | +[testenv:lint] |
472 | +commands = |
473 | + flake8 |
474 | + black --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
475 | +deps = |
476 | + black |
477 | + flake8 |
478 | + flake8-docstrings |
479 | + flake8-import-order |
480 | + pep8-naming |
481 | + flake8-colors |
482 | + |
483 | +[flake8] |
484 | +exclude = |
485 | + .git, |
486 | + __pycache__, |
487 | + .tox, |
488 | + charmhelpers, |
489 | + mod, |
490 | + .build |
491 | + |
492 | +max-line-length = 88 |
493 | +max-complexity = 10 |
494 | + |
495 | +[testenv:black] |
496 | +commands = |
497 | + black --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
498 | +deps = |
499 | + black |
500 | + |
501 | +[testenv:unit] |
502 | +commands = |
503 | + coverage run -m unittest discover -s {toxinidir}/tests/unit -v |
504 | + coverage report --omit tests/*,mod/*,.tox/* |
505 | + coverage html --omit tests/*,mod/*,.tox/* |
506 | +deps = -r{toxinidir}/tests/unit/requirements.txt |
507 | + |
508 | +[testenv:func] |
509 | +commands = pytest -v --ignore {toxinidir}/tests/unit |
510 | +deps = -r{toxinidir}/tests/functional/requirements.txt |
511 | diff --git a/tox.ini_unitunittest_funczaza b/tox.ini_unitunittest_funczaza |
512 | new file mode 100644 |
513 | index 0000000..4214c14 |
514 | --- /dev/null |
515 | +++ b/tox.ini_unitunittest_funczaza |
516 | @@ -0,0 +1,65 @@ |
517 | +[tox] |
518 | +skipsdist=True |
519 | +skip_missing_interpreters = True |
520 | +envlist = lint, unit, func |
521 | + |
522 | +[testenv] |
523 | +basepython = python3 |
524 | +setenv = |
525 | + PYTHONPATH = {toxinidir}:{toxinidir}/lib/:{toxinidir}/hooks/ |
526 | +passenv = |
527 | + HOME |
528 | + PATH |
529 | + CHARM_BUILD_DIR |
530 | + PYTEST_KEEP_MODEL |
531 | + PYTEST_CLOUD_NAME |
532 | + PYTEST_CLOUD_REGION |
533 | + PYTEST_MODEL |
534 | + MODEL_SETTINGS |
535 | + HTTP_PROXY |
536 | + HTTPS_PROXY |
537 | + NO_PROXY |
538 | + SNAP_HTTP_PROXY |
539 | + SNAP_HTTPS_PROXY |
540 | + |
541 | +[testenv:lint] |
542 | +commands = |
543 | + flake8 |
544 | + black --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
545 | +deps = |
546 | + black |
547 | + flake8 |
548 | + flake8-docstrings |
549 | + flake8-import-order |
550 | + pep8-naming |
551 | + flake8-colors |
552 | + |
553 | +[flake8] |
554 | +exclude = |
555 | + .git, |
556 | + __pycache__, |
557 | + .tox, |
558 | + charmhelpers, |
559 | + mod, |
560 | + .build |
561 | + |
562 | +max-line-length = 88 |
563 | +max-complexity = 10 |
564 | + |
565 | +[testenv:black] |
566 | +commands = |
567 | + black --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . |
568 | +deps = |
569 | + black |
570 | + |
571 | +[testenv:unit] |
572 | +commands = |
573 | + coverage run -m unittest discover -s {toxinidir}/tests/unit -v |
574 | + coverage report --omit tests/*,mod/*,.tox/* |
575 | + coverage html --omit tests/*,mod/*,.tox/* |
576 | +deps = -r{toxinidir}/tests/unit/requirements.txt |
577 | + |
578 | +[testenv:func] |
579 | +changedir = {toxinidir}/tests/functional |
580 | +commands = functest-run-suite {posargs} |
581 | +deps = -r{toxinidir}/tests/functional/requirements.txt |
I've reviewed this change partially. I'll finish later today.