| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 1 | # Tox (http://tox.testrun.org/) is a tool for running tests |
| 2 | # in multiple virtualenvs. This configuration file will run the |
| 3 | # test suite on all supported python versions. To use it, "pip install tox" |
| 4 | # and then run "tox" from this directory. |
| 5 | |
| 6 | [tox] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 7 | envlist = py3,lint,integration |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 8 | skipsdist=True |
| 9 | |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 10 | [pytest] |
| 11 | markers = |
| 12 | serial: mark a test that must run by itself |
| 13 | |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 14 | [testenv] |
| 15 | basepython=python3 |
| 16 | usedevelop=True |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 17 | |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 18 | # for testing with other python versions |
| Adam Israel | b2c234b | 2019-04-05 10:17:25 -0400 | [diff] [blame] | 19 | 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] | 20 | passenv = |
| 21 | HOME |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 22 | VCA_PATH |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 23 | VCA_HOST |
| 24 | VCA_PORT |
| 25 | VCA_USER |
| 26 | VCA_SECRET |
| Adam Israel | b2a07f5 | 2019-04-25 17:17:05 -0400 | [diff] [blame] | 27 | LXD_HOST |
| 28 | LXD_SECRET |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 29 | # These are needed so executing `charm build` succeeds |
| 30 | TERM |
| 31 | TERMINFO |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 32 | deps = |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 33 | mock |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 34 | pyyaml |
| 35 | pytest |
| 36 | pytest-asyncio |
| 37 | pytest-xdist |
| Adam Israel | 6d84dbd | 2019-03-08 18:33:35 -0500 | [diff] [blame] | 38 | pytest-assume |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 39 | paramiko |
| 40 | pylxd |
| 41 | |
| 42 | [testenv:py3] |
| 43 | # default tox env, excludes integration and serial tests |
| 44 | commands = |
| Adam Israel | b2c234b | 2019-04-05 10:17:25 -0400 | [diff] [blame] | 45 | pytest --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 46 | |
| 47 | [testenv:lint] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 48 | envdir = {toxworkdir}/py3 |
| Adam Israel | c3e6c2e | 2018-03-01 09:31:50 -0500 | [diff] [blame] | 49 | commands = |
| Adam Israel | fc511ed | 2018-09-21 14:20:55 +0200 | [diff] [blame] | 50 | 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] | 51 | deps = |
| 52 | flake8 |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 53 | |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 54 | [testenv:integration] |
| 55 | envdir = {toxworkdir}/py3 |
| Adam Israel | b2c234b | 2019-04-05 10:17:25 -0400 | [diff] [blame] | 56 | 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] | 57 | |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 58 | [testenv:build] |
| Adam Israel | 5e08a0e | 2018-09-06 19:22:47 -0400 | [diff] [blame] | 59 | deps = |
| 60 | stdeb |
| 61 | setuptools-version-command |
| Mike Marchetti | 4b81dfa | 2018-04-18 10:52:18 -0400 | [diff] [blame] | 62 | commands = python3 setup.py --command-packages=stdeb.command bdist_deb |