blob: 4685666646311aba23248ebf5e2647977d334e0b [file] [log] [blame]
Adam Israel19c5cfc2019-10-03 12:35:38 -04001# 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 Israelc3e6c2e2018-03-01 09:31:50 -050015# 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 Israel5e08a0e2018-09-06 19:22:47 -040021envlist = py3,lint,integration
Adam Israelc3e6c2e2018-03-01 09:31:50 -050022skipsdist=True
23
Adam Israel5e08a0e2018-09-06 19:22:47 -040024[pytest]
25markers =
26 serial: mark a test that must run by itself
27
Adam Israelc3e6c2e2018-03-01 09:31:50 -050028[testenv]
29basepython=python3
30usedevelop=True
Adam Israelb2a07f52019-04-25 17:17:05 -040031
Adam Israelc3e6c2e2018-03-01 09:31:50 -050032# for testing with other python versions
Adam Israelb2c234b2019-04-05 10:17:25 -040033commands = py.test --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs}
Adam Israel5e08a0e2018-09-06 19:22:47 -040034passenv =
35 HOME
Adam Israelb2a07f52019-04-25 17:17:05 -040036 VCA_PATH
Adam Israel5e08a0e2018-09-06 19:22:47 -040037 VCA_HOST
38 VCA_PORT
39 VCA_USER
40 VCA_SECRET
Adam Israelb2a07f52019-04-25 17:17:05 -040041 LXD_HOST
42 LXD_SECRET
Adam Israel19c5cfc2019-10-03 12:35:38 -040043 VCA_CACERT
Adam Israel5e08a0e2018-09-06 19:22:47 -040044 # These are needed so executing `charm build` succeeds
45 TERM
46 TERMINFO
Adam Israelc3e6c2e2018-03-01 09:31:50 -050047deps =
Adam Israelc3e6c2e2018-03-01 09:31:50 -050048 mock
Adam Israel5e08a0e2018-09-06 19:22:47 -040049 pyyaml
50 pytest
51 pytest-asyncio
52 pytest-xdist
Adam Israel6d84dbd2019-03-08 18:33:35 -050053 pytest-assume
Adam Israel5e08a0e2018-09-06 19:22:47 -040054 paramiko
55 pylxd
56
57[testenv:py3]
58# default tox env, excludes integration and serial tests
59commands =
Adam Israel19c5cfc2019-10-03 12:35:38 -040060 pytest --ignore modules/ --ignore tests/charms/ --tb native -ra -v -n auto -k 'not integration' -m 'not serial' {posargs}
Adam Israelc3e6c2e2018-03-01 09:31:50 -050061
62[testenv:lint]
Adam Israel5e08a0e2018-09-06 19:22:47 -040063envdir = {toxworkdir}/py3
Adam Israelc3e6c2e2018-03-01 09:31:50 -050064commands =
Adam Israelfc511ed2018-09-21 14:20:55 +020065 flake8 --ignore E501,E402 --exclude tests/charms/builds,tests/charms/deps {posargs} n2vc tests
Adam Israelc3e6c2e2018-03-01 09:31:50 -050066deps =
67 flake8
Mike Marchetti4b81dfa2018-04-18 10:52:18 -040068
Adam Israel5e08a0e2018-09-06 19:22:47 -040069[testenv:integration]
70envdir = {toxworkdir}/py3
Adam Israelb2c234b2019-04-05 10:17:25 -040071commands = py.test --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n 1 -k 'integration' -m 'serial' {posargs}
Adam Israel5e08a0e2018-09-06 19:22:47 -040072
Mike Marchetti4b81dfa2018-04-18 10:52:18 -040073[testenv:build]
Adam Israel5e08a0e2018-09-06 19:22:47 -040074deps =
75 stdeb
76 setuptools-version-command
Mike Marchetti4b81dfa2018-04-18 10:52:18 -040077commands = python3 setup.py --command-packages=stdeb.command bdist_deb