Merge ~peppepetra/charm-sudo-pair:makefile-20.08 into charm-sudo-pair:master
- Git
- lp:~peppepetra/charm-sudo-pair
- makefile-20.08
- Merge into master
Proposed by
Giuseppe Petralia
Status: | Merged |
---|---|
Approved by: | Xav Paice |
Approved revision: | 421e6853e4098e11025c4e180215b1eeb76c604e |
Merged at revision: | 421e6853e4098e11025c4e180215b1eeb76c604e |
Proposed branch: | ~peppepetra/charm-sudo-pair:makefile-20.08 |
Merge into: | charm-sudo-pair:master |
Diff against target: |
441 lines (+133/-78) 9 files modified
.gitignore (+24/-16) Makefile (+60/-33) dev/null (+0/-1) interfaces/.empty (+0/-0) layers/.empty (+0/-0) src/actions/remove-sudopair (+1/-0) src/tests/functional/conftest.py (+1/-1) src/tests/functional/test_deploy.py (+2/-2) src/tox.ini (+45/-25) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xav Paice (community) | Approve | ||
Paul Goins | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Xav Paice (xavpaice) wrote : | # |
LGTM, agreed on the things that could be cleaned up but I don't want to delay this change for those.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.gitignore b/.gitignore | |||
2 | index eda8bea..6f1f367 100644 | |||
3 | --- a/.gitignore | |||
4 | +++ b/.gitignore | |||
5 | @@ -1,33 +1,41 @@ | |||
6 | 1 | # Juju files | ||
7 | 2 | .unit-state.db | ||
8 | 3 | .go-cookies | ||
9 | 4 | |||
10 | 5 | layers/* | ||
11 | 6 | interfaces/* | ||
12 | 7 | |||
13 | 1 | # Byte-compiled / optimized / DLL files | 8 | # Byte-compiled / optimized / DLL files |
14 | 2 | __pycache__/ | 9 | __pycache__/ |
15 | 3 | *.py[cod] | 10 | *.py[cod] |
16 | 4 | *$py.class | 11 | *$py.class |
17 | 5 | 12 | ||
18 | 13 | # Tests files and dir | ||
19 | 14 | .pytest_cache/ | ||
20 | 15 | .coverage | ||
21 | 16 | .tox | ||
22 | 17 | report/ | ||
23 | 18 | htmlcov/ | ||
24 | 19 | |||
25 | 6 | # Log files | 20 | # Log files |
26 | 7 | *.log | 21 | *.log |
27 | 8 | 22 | ||
31 | 9 | .tox/ | 23 | # pycharm |
32 | 10 | src/.tox/ | 24 | .idea/ |
30 | 11 | .coverage | ||
33 | 12 | 25 | ||
34 | 13 | # vi | 26 | # vi |
35 | 14 | .*.swp | 27 | .*.swp |
36 | 15 | 28 | ||
37 | 16 | # pycharm | ||
38 | 17 | .idea/ | ||
39 | 18 | .unit-state.db | ||
40 | 19 | src/.unit-state.db | ||
41 | 20 | |||
42 | 21 | # version data | 29 | # version data |
43 | 22 | repo-info | 30 | repo-info |
44 | 31 | version | ||
45 | 23 | 32 | ||
46 | 33 | # Python builds | ||
47 | 34 | deb_dist/ | ||
48 | 35 | dist/ | ||
49 | 24 | 36 | ||
56 | 25 | # reports | 37 | # Snaps |
57 | 26 | report/* | 38 | *.snap |
52 | 27 | src/report/* | ||
53 | 28 | |||
54 | 29 | # virtual env | ||
55 | 30 | venv/* | ||
58 | 31 | 39 | ||
59 | 32 | # builds | ||
60 | 33 | builds/* | ||
61 | 34 | \ No newline at end of file | 40 | \ No newline at end of file |
62 | 41 | # Builds | ||
63 | 42 | .build/ | ||
64 | 35 | \ No newline at end of file | 43 | \ No newline at end of file |
65 | diff --git a/Makefile b/Makefile | |||
66 | index c7506b2..0a84b5f 100644 | |||
67 | --- a/Makefile | |||
68 | +++ b/Makefile | |||
69 | @@ -1,53 +1,80 @@ | |||
72 | 1 | PROJECTPATH = $(dir $(realpath $(MAKEFILE_LIST))) | 1 | PYTHON := /usr/bin/python3 |
71 | 2 | DIRNAME = $(notdir $(PROJECTPATH:%/=%)) | ||
73 | 3 | 2 | ||
74 | 3 | PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST))) | ||
75 | 4 | ifndef CHARM_BUILD_DIR | 4 | ifndef CHARM_BUILD_DIR |
78 | 5 | CHARM_BUILD_DIR := /tmp/$(DIRNAME)-builds | 5 | CHARM_BUILD_DIR=${PROJECTPATH}.build |
77 | 6 | $(warning Warning CHARM_BUILD_DIR was not set, defaulting to $(CHARM_BUILD_DIR)) | ||
79 | 7 | endif | 6 | endif |
80 | 7 | ifndef CHARM_LAYERS_DIR | ||
81 | 8 | CHARM_LAYERS_DIR=${PROJECTPATH}/layers | ||
82 | 9 | endif | ||
83 | 10 | ifndef CHARM_INTERFACES_DIR | ||
84 | 11 | CHARM_INTERFACES_DIR=${PROJECTPATH}/interfaces | ||
85 | 12 | endif | ||
86 | 13 | METADATA_FILE="src/metadata.yaml" | ||
87 | 14 | CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E "^name:" | awk '{print $$2}') | ||
88 | 8 | 15 | ||
89 | 9 | help: | 16 | help: |
90 | 10 | @echo "This project supports the following targets" | 17 | @echo "This project supports the following targets" |
91 | 11 | @echo "" | 18 | @echo "" |
92 | 12 | @echo " make help - show this text" | 19 | @echo " make help - show this text" |
93 | 13 | @echo " make lint - run flake8" | ||
94 | 14 | @echo " make test - run the functional tests, unittests and lint" | ||
95 | 15 | @echo " make unittest - run the tests defined in the unittest subdirectory" | ||
96 | 16 | @echo " make functional - run the tests defined in the functional subdirectory" | ||
97 | 17 | @echo " make release - build the charm" | ||
98 | 18 | @echo " make clean - remove unneeded files" | 20 | @echo " make clean - remove unneeded files" |
99 | 21 | @echo " make submodules - make sure that the submodules are up-to-date" | ||
100 | 22 | @echo " make submodules-update - update submodules to latest changes on remote branch" | ||
101 | 23 | @echo " make build - build the charm" | ||
102 | 24 | @echo " make release - run clean, submodules, and build targets" | ||
103 | 25 | @echo " make lint - run flake8 and black --check" | ||
104 | 26 | @echo " make black - run black and reformat files" | ||
105 | 27 | @echo " make proof - run charm proof" | ||
106 | 28 | @echo " make unittests - run the tests defined in the unittest subdirectory" | ||
107 | 29 | @echo " make functional - run the tests defined in the functional subdirectory" | ||
108 | 30 | @echo " make test - run lint, proof, unittests and functional targets" | ||
109 | 19 | @echo "" | 31 | @echo "" |
110 | 20 | 32 | ||
116 | 21 | lint: | 33 | clean: |
117 | 22 | @echo "Running flake8" | 34 | @echo "Cleaning files" |
118 | 23 | @tox -e lint | 35 | @git clean -ffXd -e '!.idea' |
119 | 24 | 36 | @echo "Cleaning existing build" | |
120 | 25 | test: lint unittest functional | 37 | @rm -rf ${CHARM_BUILD_DIR}/${CHARM_NAME} |
121 | 26 | 38 | ||
127 | 27 | functional: build | 39 | submodules: |
128 | 28 | @PYTEST_KEEP_MODEL=$(PYTEST_KEEP_MODEL) \ | 40 | # @git submodule update --init --recursive |
129 | 29 | PYTEST_CLOUD_NAME=$(PYTEST_CLOUD_NAME) \ | 41 | @echo "No submodules. Skipping." |
125 | 30 | PYTEST_CLOUD_REGION=$(PYTEST_CLOUD_REGION) \ | ||
126 | 31 | tox -e functional | ||
130 | 32 | 42 | ||
133 | 33 | unittest: | 43 | submodules-update: |
134 | 34 | @tox -e unit | 44 | # @git submodule update --init --recursive --remote --merge |
135 | 45 | @echo "No submodules. Skipping." | ||
136 | 35 | 46 | ||
137 | 36 | build: | 47 | build: |
142 | 37 | @echo "Building charm to base directory $(CHARM_BUILD_DIR)" | 48 | @echo "Building charm to directory ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
143 | 38 | @-git describe --tags > ./repo-info | 49 | @-git rev-parse --abbrev-ref HEAD > ./src/repo-info |
144 | 39 | @CHARM_LAYERS_DIR=./layers CHARM_INTERFACES_DIR=./interfaces TERM=linux\ | 50 | @CHARM_LAYERS_DIR=${CHARM_LAYERS_DIR} CHARM_INTERFACES_DIR=${CHARM_INTERFACES_DIR} \ |
145 | 40 | charm build --output-dir $(CHARM_BUILD_DIR) $(PROJECTPATH) --force | 51 | TERM=linux CHARM_BUILD_DIR=${CHARM_BUILD_DIR} charm build src/ |
146 | 41 | 52 | ||
147 | 42 | release: clean build | 53 | release: clean build |
149 | 43 | @echo "Charm is built at $(CHARM_BUILD_DIR)/builds" | 54 | @echo "Charm is built at ${CHARM_BUILD_DIR}/${CHARM_NAME}" |
150 | 44 | 55 | ||
157 | 45 | clean: | 56 | lint: |
158 | 46 | @echo "Cleaning files" | 57 | @echo "Running lint checks" |
159 | 47 | @find $(PROJECTPATH) -iname __pycache__ -exec rm -r {} + | 58 | @cd src && tox -e lint |
160 | 48 | @if [ -d $(CHARM_BUILD_DIR)/builds ] ; then rm -r $(CHARM_BUILD_DIR)/builds ; fi | 59 | |
161 | 49 | @if [ -d $(PROJECTPATH)/.tox ] ; then rm -r $(PROJECTPATH)/.tox ; fi | 60 | black: |
162 | 50 | @if [ -d $(PROJECTPATH)/.pytest_cache ] ; then rm -r $(PROJECTPATH)/.pytest_cache ; fi | 61 | @echo "Reformat files with black" |
163 | 62 | @cd src && tox -e black | ||
164 | 63 | |||
165 | 64 | proof: build | ||
166 | 65 | @echo "Running charm proof" | ||
167 | 66 | @charm proof ${CHARM_BUILD_DIR}/${CHARM_NAME} | ||
168 | 67 | |||
169 | 68 | unittests: | ||
170 | 69 | @echo "Running unit tests" | ||
171 | 70 | @cd src && tox -e unit | ||
172 | 71 | |||
173 | 72 | functional: build | ||
174 | 73 | @echo "Executing functional tests in ${CHARM_BUILD_DIR}" | ||
175 | 74 | @cd src && CHARM_BUILD_DIR=${CHARM_BUILD_DIR} tox -e func | ||
176 | 75 | |||
177 | 76 | test: lint proof unittests functional | ||
178 | 77 | @echo "Tests completed for charm ${CHARM_NAME}." | ||
179 | 51 | 78 | ||
180 | 52 | # The targets below don't depend on a file | 79 | # The targets below don't depend on a file |
182 | 53 | .PHONY: lint test unittest functional build release clean help | 80 | .PHONY: help submodules submodules-update clean build release lint black proof unittests functional test |
183 | diff --git a/actions/remove-sudopair b/actions/remove-sudopair | |||
184 | 54 | deleted file mode 120000 | 81 | deleted file mode 120000 |
185 | index ff9536b..0000000 | |||
186 | --- a/actions/remove-sudopair | |||
187 | +++ /dev/null | |||
188 | @@ -1 +0,0 @@ | |||
189 | 1 | ./actions.py | ||
190 | 2 | \ No newline at end of file | 0 | \ No newline at end of file |
191 | diff --git a/interfaces/.empty b/interfaces/.empty | |||
192 | 3 | new file mode 100644 | 1 | new file mode 100644 |
193 | index 0000000..e69de29 | |||
194 | --- /dev/null | |||
195 | +++ b/interfaces/.empty | |||
196 | diff --git a/layers/.empty b/layers/.empty | |||
197 | 4 | new file mode 100644 | 2 | new file mode 100644 |
198 | index 0000000..e69de29 | |||
199 | --- /dev/null | |||
200 | +++ b/layers/.empty | |||
201 | diff --git a/README.md b/src/README.md | |||
202 | 5 | similarity index 100% | 3 | similarity index 100% |
203 | 6 | rename from README.md | 4 | rename from README.md |
204 | 7 | rename to src/README.md | 5 | rename to src/README.md |
205 | diff --git a/actions.yaml b/src/actions.yaml | |||
206 | 8 | similarity index 100% | 6 | similarity index 100% |
207 | 9 | rename from actions.yaml | 7 | rename from actions.yaml |
208 | 10 | rename to src/actions.yaml | 8 | rename to src/actions.yaml |
209 | diff --git a/actions/actions.py b/src/actions/actions.py | |||
210 | 11 | similarity index 100% | 9 | similarity index 100% |
211 | 12 | rename from actions/actions.py | 10 | rename from actions/actions.py |
212 | 13 | rename to src/actions/actions.py | 11 | rename to src/actions/actions.py |
213 | diff --git a/src/actions/remove-sudopair b/src/actions/remove-sudopair | |||
214 | 14 | new file mode 120000 | 12 | new file mode 120000 |
215 | index 0000000..ff9536b | |||
216 | --- /dev/null | |||
217 | +++ b/src/actions/remove-sudopair | |||
218 | @@ -0,0 +1 @@ | |||
219 | 1 | ./actions.py | ||
220 | 0 | \ No newline at end of file | 2 | \ No newline at end of file |
221 | diff --git a/config.yaml b/src/config.yaml | |||
222 | 1 | similarity index 100% | 3 | similarity index 100% |
223 | 2 | rename from config.yaml | 4 | rename from config.yaml |
224 | 3 | rename to src/config.yaml | 5 | rename to src/config.yaml |
225 | diff --git a/files/sudo.prompt.pair b/src/files/sudo.prompt.pair | |||
226 | 4 | similarity index 100% | 6 | similarity index 100% |
227 | 5 | rename from files/sudo.prompt.pair | 7 | rename from files/sudo.prompt.pair |
228 | 6 | rename to src/files/sudo.prompt.pair | 8 | rename to src/files/sudo.prompt.pair |
229 | diff --git a/files/sudo.prompt.user b/src/files/sudo.prompt.user | |||
230 | 7 | similarity index 100% | 9 | similarity index 100% |
231 | 8 | rename from files/sudo.prompt.user | 10 | rename from files/sudo.prompt.user |
232 | 9 | rename to src/files/sudo.prompt.user | 11 | rename to src/files/sudo.prompt.user |
233 | diff --git a/files/sudo_pair.so b/src/files/sudo_pair.so | |||
234 | 10 | similarity index 100% | 12 | similarity index 100% |
235 | 11 | rename from files/sudo_pair.so | 13 | rename from files/sudo_pair.so |
236 | 12 | rename to src/files/sudo_pair.so | 14 | rename to src/files/sudo_pair.so |
237 | 13 | Binary files a/files/sudo_pair.so and b/src/files/sudo_pair.so differ | 15 | Binary files a/files/sudo_pair.so and b/src/files/sudo_pair.so differ |
238 | diff --git a/files/sudoers b/src/files/sudoers | |||
239 | 14 | similarity index 100% | 16 | similarity index 100% |
240 | 15 | rename from files/sudoers | 17 | rename from files/sudoers |
241 | 16 | rename to src/files/sudoers | 18 | rename to src/files/sudoers |
242 | diff --git a/layer.yaml b/src/layer.yaml | |||
243 | 17 | similarity index 100% | 19 | similarity index 100% |
244 | 18 | rename from layer.yaml | 20 | rename from layer.yaml |
245 | 19 | rename to src/layer.yaml | 21 | rename to src/layer.yaml |
246 | diff --git a/lib/libsudopair.py b/src/lib/libsudopair.py | |||
247 | 20 | similarity index 100% | 22 | similarity index 100% |
248 | 21 | rename from lib/libsudopair.py | 23 | rename from lib/libsudopair.py |
249 | 22 | rename to src/lib/libsudopair.py | 24 | rename to src/lib/libsudopair.py |
250 | diff --git a/metadata.yaml b/src/metadata.yaml | |||
251 | 23 | similarity index 100% | 25 | similarity index 100% |
252 | 24 | rename from metadata.yaml | 26 | rename from metadata.yaml |
253 | 25 | rename to src/metadata.yaml | 27 | rename to src/metadata.yaml |
254 | diff --git a/reactive/sudo_pair.py b/src/reactive/sudo_pair.py | |||
255 | 26 | similarity index 100% | 28 | similarity index 100% |
256 | 27 | rename from reactive/sudo_pair.py | 29 | rename from reactive/sudo_pair.py |
257 | 28 | rename to src/reactive/sudo_pair.py | 30 | rename to src/reactive/sudo_pair.py |
258 | diff --git a/templates/91-bypass-sudopair-cmds.tmpl b/src/templates/91-bypass-sudopair-cmds.tmpl | |||
259 | 29 | similarity index 100% | 31 | similarity index 100% |
260 | 30 | rename from templates/91-bypass-sudopair-cmds.tmpl | 32 | rename from templates/91-bypass-sudopair-cmds.tmpl |
261 | 31 | rename to src/templates/91-bypass-sudopair-cmds.tmpl | 33 | rename to src/templates/91-bypass-sudopair-cmds.tmpl |
262 | diff --git a/templates/sudo.conf.tmpl b/src/templates/sudo.conf.tmpl | |||
263 | 32 | similarity index 100% | 34 | similarity index 100% |
264 | 33 | rename from templates/sudo.conf.tmpl | 35 | rename from templates/sudo.conf.tmpl |
265 | 34 | rename to src/templates/sudo.conf.tmpl | 36 | rename to src/templates/sudo.conf.tmpl |
266 | diff --git a/templates/sudo_approve.tmpl b/src/templates/sudo_approve.tmpl | |||
267 | 35 | similarity index 100% | 37 | similarity index 100% |
268 | 36 | rename from templates/sudo_approve.tmpl | 38 | rename from templates/sudo_approve.tmpl |
269 | 37 | rename to src/templates/sudo_approve.tmpl | 39 | rename to src/templates/sudo_approve.tmpl |
270 | diff --git a/tests/00-unit b/src/tests/00-unit | |||
271 | 38 | similarity index 100% | 40 | similarity index 100% |
272 | 39 | rename from tests/00-unit | 41 | rename from tests/00-unit |
273 | 40 | rename to src/tests/00-unit | 42 | rename to src/tests/00-unit |
274 | diff --git a/tests/01-functional b/src/tests/01-functional | |||
275 | 41 | similarity index 100% | 43 | similarity index 100% |
276 | 42 | rename from tests/01-functional | 44 | rename from tests/01-functional |
277 | 43 | rename to src/tests/01-functional | 45 | rename to src/tests/01-functional |
278 | diff --git a/tests/functional/conftest.py b/src/tests/functional/conftest.py | |||
279 | 44 | similarity index 99% | 46 | similarity index 99% |
280 | 45 | rename from tests/functional/conftest.py | 47 | rename from tests/functional/conftest.py |
281 | 46 | rename to src/tests/functional/conftest.py | 48 | rename to src/tests/functional/conftest.py |
282 | index aa42a09..68f3ffe 100644 | |||
283 | --- a/tests/functional/conftest.py | |||
284 | +++ b/src/tests/functional/conftest.py | |||
285 | @@ -43,7 +43,7 @@ async def model(controller): | |||
286 | 43 | model = await controller.add_model(model_name) | 43 | model = await controller.add_model(model_name) |
287 | 44 | yield model | 44 | yield model |
288 | 45 | await model.disconnect() | 45 | await model.disconnect() |
290 | 46 | if os.getenv('test_preserve_model'): | 46 | if os.getenv('PYTEST_KEEP_MODEL'): |
291 | 47 | return | 47 | return |
292 | 48 | await controller.destroy_model(model_name) | 48 | await controller.destroy_model(model_name) |
293 | 49 | while model_name in await controller.list_models(): | 49 | while model_name in await controller.list_models(): |
294 | diff --git a/tests/functional/requirements.txt b/src/tests/functional/requirements.txt | |||
295 | 50 | similarity index 100% | 50 | similarity index 100% |
296 | 51 | rename from tests/functional/requirements.txt | 51 | rename from tests/functional/requirements.txt |
297 | 52 | rename to src/tests/functional/requirements.txt | 52 | rename to src/tests/functional/requirements.txt |
298 | diff --git a/tests/functional/test_deploy.py b/src/tests/functional/test_deploy.py | |||
299 | 53 | similarity index 98% | 53 | similarity index 98% |
300 | 54 | rename from tests/functional/test_deploy.py | 54 | rename from tests/functional/test_deploy.py |
301 | 55 | rename to src/tests/functional/test_deploy.py | 55 | rename to src/tests/functional/test_deploy.py |
302 | index 2f0f272..1d531d1 100644 | |||
303 | --- a/tests/functional/test_deploy.py | |||
304 | +++ b/src/tests/functional/test_deploy.py | |||
305 | @@ -6,10 +6,10 @@ import pytest | |||
306 | 6 | 6 | ||
307 | 7 | pytestmark = pytest.mark.asyncio | 7 | pytestmark = pytest.mark.asyncio |
308 | 8 | 8 | ||
310 | 9 | charm_build_dir = os.getenv("CHARM_BUILD_DIR", "..").rstrip("/") | 9 | charm_build_dir = os.getenv("CHARM_BUILD_DIR").rstrip("/") |
311 | 10 | 10 | ||
312 | 11 | 11 | ||
314 | 12 | sources = [("local", "{}/builds/sudo-pair".format(charm_build_dir))] | 12 | sources = [("local", "{}/sudo-pair".format(charm_build_dir))] |
315 | 13 | 13 | ||
316 | 14 | series = [ | 14 | series = [ |
317 | 15 | "xenial", | 15 | "xenial", |
318 | diff --git a/tests/tests.yaml b/src/tests/tests.yaml | |||
319 | 16 | similarity index 100% | 16 | similarity index 100% |
320 | 17 | rename from tests/tests.yaml | 17 | rename from tests/tests.yaml |
321 | 18 | rename to src/tests/tests.yaml | 18 | rename to src/tests/tests.yaml |
322 | diff --git a/tests/unit/conftest.py b/src/tests/unit/conftest.py | |||
323 | 19 | similarity index 100% | 19 | similarity index 100% |
324 | 20 | rename from tests/unit/conftest.py | 20 | rename from tests/unit/conftest.py |
325 | 21 | rename to src/tests/unit/conftest.py | 21 | rename to src/tests/unit/conftest.py |
326 | diff --git a/tests/unit/requirements.txt b/src/tests/unit/requirements.txt | |||
327 | 22 | similarity index 100% | 22 | similarity index 100% |
328 | 23 | rename from tests/unit/requirements.txt | 23 | rename from tests/unit/requirements.txt |
329 | 24 | rename to src/tests/unit/requirements.txt | 24 | rename to src/tests/unit/requirements.txt |
330 | diff --git a/tests/unit/test_actions.py b/src/tests/unit/test_actions.py | |||
331 | 25 | similarity index 100% | 25 | similarity index 100% |
332 | 26 | rename from tests/unit/test_actions.py | 26 | rename from tests/unit/test_actions.py |
333 | 27 | rename to src/tests/unit/test_actions.py | 27 | rename to src/tests/unit/test_actions.py |
334 | diff --git a/tests/unit/test_libsudopair.py b/src/tests/unit/test_libsudopair.py | |||
335 | 28 | similarity index 100% | 28 | similarity index 100% |
336 | 29 | rename from tests/unit/test_libsudopair.py | 29 | rename from tests/unit/test_libsudopair.py |
337 | 30 | rename to src/tests/unit/test_libsudopair.py | 30 | rename to src/tests/unit/test_libsudopair.py |
338 | diff --git a/tox.ini b/src/tox.ini | |||
339 | 31 | similarity index 62% | 31 | similarity index 62% |
340 | 32 | rename from tox.ini | 32 | rename from tox.ini |
341 | 33 | rename to src/tox.ini | 33 | rename to src/tox.ini |
342 | index fc364de..d07b692 100644 | |||
343 | --- a/tox.ini | |||
344 | +++ b/src/tox.ini | |||
345 | @@ -1,51 +1,71 @@ | |||
346 | 1 | [tox] | 1 | [tox] |
347 | 2 | skipsdist=True | 2 | skipsdist=True |
348 | 3 | envlist = unit, functional | ||
349 | 4 | skip_missing_interpreters = True | 3 | skip_missing_interpreters = True |
350 | 4 | envlist = lint, unit, func | ||
351 | 5 | 5 | ||
352 | 6 | [testenv] | 6 | [testenv] |
353 | 7 | basepython = python3 | 7 | basepython = python3 |
354 | 8 | setenv = | 8 | setenv = |
370 | 9 | PYTHONPATH = . | 9 | PYTHONPATH = {toxinidir}:{toxinidir}/lib/:{toxinidir}/hooks/ |
356 | 10 | |||
357 | 11 | [testenv:unit] | ||
358 | 12 | commands = pytest -v --ignore {toxinidir}/tests/functional \ | ||
359 | 13 | --cov=lib \ | ||
360 | 14 | --cov=reactive \ | ||
361 | 15 | --cov=actions \ | ||
362 | 16 | --cov-report=term \ | ||
363 | 17 | --cov-report=annotate:report/annotated \ | ||
364 | 18 | --cov-report=html:report/html | ||
365 | 19 | deps = -r{toxinidir}/tests/unit/requirements.txt | ||
366 | 20 | |||
367 | 21 | setenv = PYTHONPATH={toxinidir}/lib | ||
368 | 22 | |||
369 | 23 | [testenv:functional] | ||
371 | 24 | passenv = | 10 | passenv = |
372 | 25 | HOME | 11 | HOME |
373 | 26 | CHARM_BUILD_DIR | ||
374 | 27 | PATH | 12 | PATH |
375 | 13 | CHARM_BUILD_DIR | ||
376 | 28 | PYTEST_KEEP_MODEL | 14 | PYTEST_KEEP_MODEL |
377 | 29 | PYTEST_CLOUD_NAME | 15 | PYTEST_CLOUD_NAME |
378 | 30 | PYTEST_CLOUD_REGION | 16 | PYTEST_CLOUD_REGION |
382 | 31 | commands = pytest -v --ignore {toxinidir}/tests/unit | 17 | PYTEST_MODEL |
383 | 32 | deps = -r{toxinidir}/tests/functional/requirements.txt | 18 | MODEL_SETTINGS |
384 | 33 | 19 | HTTP_PROXY | |
385 | 20 | HTTPS_PROXY | ||
386 | 21 | NO_PROXY | ||
387 | 22 | SNAP_HTTP_PROXY | ||
388 | 23 | SNAP_HTTPS_PROXY | ||
389 | 34 | 24 | ||
390 | 35 | [testenv:lint] | 25 | [testenv:lint] |
392 | 36 | commands = flake8 | 26 | commands = |
393 | 27 | flake8 | ||
394 | 28 | #TODO black --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . | ||
395 | 37 | deps = | 29 | deps = |
396 | 30 | black | ||
397 | 38 | flake8 | 31 | flake8 |
401 | 39 | flake8-docstrings | 32 | #TODO flake8-docstrings |
402 | 40 | flake8-import-order | 33 | #TODO flake8-import-order |
403 | 41 | pep8-naming | 34 | #TODO pep8-naming |
404 | 42 | flake8-colors | 35 | flake8-colors |
405 | 43 | 36 | ||
406 | 44 | [flake8] | 37 | [flake8] |
407 | 45 | ignore = D100,D103 # Missing docstring in public module/function | ||
408 | 46 | exclude = | 38 | exclude = |
409 | 47 | .git, | 39 | .git, |
410 | 48 | __pycache__, | 40 | __pycache__, |
411 | 49 | .tox, | 41 | .tox, |
412 | 42 | charmhelpers, | ||
413 | 43 | mod, | ||
414 | 44 | .build | ||
415 | 45 | |||
416 | 50 | max-line-length = 120 | 46 | max-line-length = 120 |
417 | 47 | #TODO max-line-length = 88 | ||
418 | 51 | max-complexity = 10 | 48 | max-complexity = 10 |
419 | 49 | |||
420 | 50 | [testenv:black] | ||
421 | 51 | commands = | ||
422 | 52 | black --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . | ||
423 | 53 | deps = | ||
424 | 54 | black | ||
425 | 55 | |||
426 | 56 | [testenv:unit] | ||
427 | 57 | commands = | ||
428 | 58 | pytest -v --ignore {toxinidir}/tests/functional \ | ||
429 | 59 | --cov=lib \ | ||
430 | 60 | --cov=reactive \ | ||
431 | 61 | --cov=actions \ | ||
432 | 62 | --cov=hooks \ | ||
433 | 63 | --cov=src \ | ||
434 | 64 | --cov-report=term \ | ||
435 | 65 | --cov-report=annotate:report/annotated \ | ||
436 | 66 | --cov-report=html:report/html | ||
437 | 67 | deps = -r{toxinidir}/tests/unit/requirements.txt | ||
438 | 68 | |||
439 | 69 | [testenv:func] | ||
440 | 70 | commands = pytest -v --ignore {toxinidir}/tests/unit | ||
441 | 71 | deps = -r{toxinidir}/tests/functional/requirements.txt |
LGTM. I did notice a couple of things which could get cleaned up and are (maybe, arguably) within scope, but they're not critical.