| Adam Israel | 19c5cfc | 2019-10-03 12:35:38 -0400 | [diff] [blame] | 1 | # Copyright 2019 Canonical Ltd. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 15 | # Tox (http://tox.testrun.org/) is a tool for running tests |
| 16 | # in multiple virtualenvs. This configuration file will run the |
| 17 | # test suite on all supported python versions. To use it, "pip install tox" |
| 18 | # and then run "tox" from this directory. |
| 19 | |
| 20 | [tox] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 21 | envlist = py3,lint,integration |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 22 | skipsdist=True |
| 23 | |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 24 | [pytest] |
| 25 | markers = |
| 26 | serial: mark a test that must run by itself |
| 27 | |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 28 | [testenv] |
| 29 | basepython=python3 |
| 30 | usedevelop=True |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 31 | |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 32 | # for testing with other python versions |
| Adam Israel | b2c234b | 2019-04-05 10:17:25 -0400 | [diff] [blame] | 33 | commands = py.test --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 34 | passenv = |
| 35 | HOME |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 36 | VCA_PATH |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 37 | VCA_HOST |
| 38 | VCA_PORT |
| 39 | VCA_USER |
| 40 | VCA_SECRET |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 41 | LXD_HOST |
| 42 | LXD_SECRET |
| Adam Israel | 19c5cfc | 2019-10-03 12:35:38 -0400 | [diff] [blame] | 43 | VCA_CACERT |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 44 | # These are needed so executing `charm build` succeeds |
| 45 | TERM |
| 46 | TERMINFO |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 47 | deps = |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 48 | mock |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 49 | pyyaml |
| 50 | pytest |
| 51 | pytest-asyncio |
| 52 | pytest-xdist |
| Adam Israel | 6d84dbd | 2019-03-08 18:33:35 -0500 | [diff] [blame] | 53 | pytest-assume |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 54 | paramiko |
| 55 | pylxd |
| 56 | |
| 57 | [testenv:py3] |
| 58 | # default tox env, excludes integration and serial tests |
| 59 | commands = |
| Adam Israel | 19c5cfc | 2019-10-03 12:35:38 -0400 | [diff] [blame] | 60 | pytest --ignore modules/ --ignore tests/charms/ --tb native -ra -v -n auto -k 'not integration' -m 'not serial' {posargs} |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 61 | |
| 62 | [testenv:lint] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 63 | envdir = {toxworkdir}/py3 |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 64 | commands = |
| Adam Israel | fc511ed | 2018-09-21 14:20:55 +0200 | [diff] [blame] | 65 | flake8 --ignore E501,E402 --exclude tests/charms/builds,tests/charms/deps {posargs} n2vc tests |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 66 | deps = |
| 67 | flake8 |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 68 | |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 69 | [testenv:integration] |
| 70 | envdir = {toxworkdir}/py3 |
| Adam Israel | b2c234b | 2019-04-05 10:17:25 -0400 | [diff] [blame] | 71 | commands = py.test --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n 1 -k 'integration' -m 'serial' {posargs} |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 72 | |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 73 | [testenv:build] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 74 | deps = |
| 75 | stdeb |
| 76 | setuptools-version-command |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 77 | commands = python3 setup.py --command-packages=stdeb.command bdist_deb |