X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=tox.ini;h=490d03e037acae647fa18774ad8b63c35c3ac3c3;hp=b353ce8d7b7e5df6697b529fc6073b54afeeb78e;hb=0a8c9afacca5010da381e6382b01e31dd4e59d23;hpb=6d84dbd8746388114361e09300697da471de20ca;ds=sidebyside diff --git a/tox.ini b/tox.ini index b353ce8..490d03e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,58 +1,77 @@ -# 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. +# 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] -envlist = py3,lint,integration +envlist = cover, flake8, pylint, pylint-tests skipsdist=True -[pytest] -markers = - serial: mark a test that must run by itself - [testenv] -basepython=python3 -usedevelop=True -# for testing with other python versions -commands = py.test --ignore modules/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} -passenv = - HOME - VCA_HOST - VCA_PORT - VCA_USER - VCA_SECRET - # These are needed so executing `charm build` succeeds - TERM - TERMINFO + +[testenv:cover] +basepython = python3 deps = - mock - pyyaml - pytest - pytest-asyncio - pytest-xdist - pytest-assume - paramiko - pylxd - -[testenv:py3] -# default tox env, excludes integration and serial tests + nose2 + -rrequirements.txt + -rtest-requirements.txt commands = - pytest --ignore modules/ --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} + coverage erase + nose2 -C --coverage n2vc --plugin nose2.plugins.junitxml -s n2vc + coverage report --omit='*tests*' + coverage html -d ./cover --omit='*tests*' + coverage xml -o coverage.xml --omit='*tests*' -[testenv:lint] -envdir = {toxworkdir}/py3 +[testenv:pylint] +basepython = python3 +deps = + pylint + -rrequirements.txt commands = - flake8 --ignore E501,E402 --exclude tests/charms/builds,tests/charms/deps {posargs} n2vc tests + pylint -E n2vc --ignore=tests + +[testenv:pylint-tests] +basepython = python3 deps = - flake8 + pylint + -rrequirements.txt + -rtest-requirements.txt +commands = + pylint -E n2vc.tests + +[testenv:black] +basepython = python3 +deps = + black +commands = + black --check --diff n2vc + +[testenv:flake8] +basepython = python3 +deps = + flake8 + -rrequirements.txt +commands = + flake8 n2vc -[testenv:integration] -envdir = {toxworkdir}/py3 -commands = py.test --ignore modules/ --tb native -ra -v -s -n 1 -k 'integration' -m 'serial' {posargs} +[flake8] +# W503 is invalid PEP-8 +max-line-length = 88 +show-source = True +ignore = W503,E203 +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,devops_stages/*,.rst [testenv:build] deps = - stdeb - setuptools-version-command + stdeb + setuptools-version-command commands = python3 setup.py --command-packages=stdeb.command bdist_deb