| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [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 | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 7 | envlist = lint,py3 |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 8 | skipsdist=True |
| 9 | |
| Adam Israel | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 10 | [pytest] |
| 11 | markers = |
| 12 | serial: mark a test that must run by itself |
| 13 | |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 14 | [testenv] |
| Adam Israel | 1a15d1c | 2017-10-23 12:00:49 -0400 | [diff] [blame] | 15 | basepython=python3 |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 16 | usedevelop=True |
| Adam Israel | 1a15d1c | 2017-10-23 12:00:49 -0400 | [diff] [blame] | 17 | # for testing with other python versions |
| Adam Israel | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 18 | commands = py.test --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 19 | passenv = |
| 20 | HOME |
| Adam Israel | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 21 | TEST_AGENTS |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 22 | deps = |
| 23 | pytest |
| 24 | pytest-asyncio |
| 25 | pytest-xdist |
| 26 | mock |
| 27 | asynctest |
| 28 | ipdb |
| 29 | |
| Adam Israel | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 30 | [testenv:py3] |
| 31 | # default tox env excludes integration and serial tests |
| 32 | commands = |
| 33 | # These need to be installed in a specific order |
| 34 | pip install urllib3==1.22 |
| 35 | pip install pylxd |
| 36 | py.test --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} |
| 37 | |
| 38 | [testenv:lint] |
| 39 | envdir = {toxworkdir}/py3 |
| 40 | commands = |
| 41 | flake8 --ignore E501 {posargs} juju tests |
| 42 | deps = |
| 43 | flake8 |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 44 | |
| Adam Israel | 1a15d1c | 2017-10-23 12:00:49 -0400 | [diff] [blame] | 45 | [testenv:lint] |
| 46 | envdir = {toxworkdir}/py35 |
| 47 | commands = |
| 48 | flake8 --ignore E501 {posargs} juju |
| 49 | deps = |
| 50 | flake8 |
| 51 | |
| Adam Israel | dcdf82b | 2017-08-15 15:26:43 -0400 | [diff] [blame] | 52 | [testenv:integration] |
| Adam Israel | b094366 | 2018-08-02 15:32:00 -0400 | [diff] [blame] | 53 | envdir = {toxworkdir}/py3 |
| 54 | commands = py.test --tb native -ra -v -s -n auto -k 'integration' -m 'not serial' {posargs} |
| 55 | |
| 56 | [testenv:serial] |
| 57 | # tests that can't be run in parallel |
| 58 | envdir = {toxworkdir}/py3 |
| 59 | commands = py.test --tb native -ra -v -s {posargs:-m 'serial'} |
| 60 | |
| 61 | [testenv:example] |
| 62 | envdir = {toxworkdir}/py3 |
| 63 | commands = python {posargs} |
| Adam Israel | 1a15d1c | 2017-10-23 12:00:49 -0400 | [diff] [blame] | 64 | |
| 65 | [flake8] |
| 66 | exclude = juju/client/_* |