Feature 8720: Get leader unit to execute action
[osm/N2VC.git] / tox.ini
diff --git a/tox.ini b/tox.ini
index ff6431e..4685666 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,25 +1,77 @@
+# Copyright 2019 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#     Unless required by applicable law or agreed to in writing, software
+#     distributed under the License is distributed on an "AS IS" BASIS,
+#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#     See the License for the specific language governing permissions and
+#     limitations under the License.
+
 # Tox (http://tox.testrun.org/) is a tool for running tests
 # in multiple virtualenvs. This configuration file will run the
 # test suite on all supported python versions. To use it, "pip install tox"
 # and then run "tox" from this directory.
 
 [tox]
 # Tox (http://tox.testrun.org/) is a tool for running tests
 # in multiple virtualenvs. This configuration file will run the
 # test suite on all supported python versions. To use it, "pip install tox"
 # and then run "tox" from this directory.
 
 [tox]
-envlist = lint,py35
+envlist = py3,lint,integration
 skipsdist=True
 
 skipsdist=True
 
+[pytest]
+markers =
+    serial: mark a test that must run by itself
+
 [testenv]
 basepython=python3
 usedevelop=True
 [testenv]
 basepython=python3
 usedevelop=True
+
 # for testing with other python versions
 # for testing with other python versions
-commands=nosetests 
+commands = py.test --ignore modules/ --ignore tests/charms/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs}
+passenv =
+    HOME
+    VCA_PATH
+    VCA_HOST
+    VCA_PORT
+    VCA_USER
+    VCA_SECRET
+    LXD_HOST
+    LXD_SECRET
+    VCA_CACERT
+    # These are needed so executing `charm build` succeeds
+    TERM
+    TERMINFO
 deps =
 deps =
-    nose
     mock
     mock
-    pyyaml 
+    pyyaml
+    pytest
+    pytest-asyncio
+    pytest-xdist
+    pytest-assume
+    paramiko
+    pylxd
+
+[testenv:py3]
+# default tox env, excludes integration and serial tests
+commands =
+    pytest --ignore modules/ --ignore tests/charms/ --tb native -ra -v -n auto -k 'not integration' -m 'not serial' {posargs}
 
 [testenv:lint]
 
 [testenv:lint]
-envdir = {toxworkdir}/py35
+envdir = {toxworkdir}/py3
 commands =
 commands =
-    flake8 --ignore E501 {posargs} juju tests
+    flake8 --ignore E501,E402 --exclude tests/charms/builds,tests/charms/deps {posargs} n2vc tests
 deps =
     flake8
 deps =
     flake8
+
+[testenv:integration]
+envdir = {toxworkdir}/py3
+commands = py.test --ignore modules/  --ignore tests/charms/ --tb native -ra -v -s -n 1 -k 'integration' -m 'serial' {posargs}
+
+[testenv:build]
+deps =
+    stdeb
+    setuptools-version-command
+commands = python3 setup.py --command-packages=stdeb.command bdist_deb