X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=tox.ini;h=4d647624818990d3e169131ea6267c40e4fa286b;hp=350a1fc114fe79fd5fab38ce2f4fe58cd24ddcd1;hb=refs%2Fchanges%2F31%2F10131%2F5;hpb=b8a8281b1785358bd5632a119c016f21811172c6 diff --git a/tox.ini b/tox.ini index 350a1fc..4d64762 100644 --- a/tox.ini +++ b/tox.ini @@ -1,66 +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 = lint,py3 +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 --tb native -ra -v -s -n auto -k 'not integration' -m 'not serial' {posargs} -passenv = - HOME - TEST_AGENTS -deps = - asynctest - ipdb - mock - pytest - pytest-asyncio - pytest-xdist - Twine - # use fork to pick up fix for https://github.com/aaugustin/websockets/pull/528 - git+https://github.com/johnsca/websockets@bug/client-redirects#egg=websockets -[testenv:py3] -# default tox env excludes integration and serial tests +[testenv:cover] +basepython = python3 +deps = + nose2 + -rrequirements.txt + -rtest-requirements.txt commands = - # These need to be installed in a specific order - pip install urllib3==1.22 - pip install pylxd - py.test --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='*n2vc/tests*' + coverage html -d ./cover --omit='*n2vc/tests*' + coverage xml -o coverage.xml --omit='*n2vc/tests*' -[testenv:lint] -envdir = {toxworkdir}/py3 -commands = - flake8 --ignore E501,W504 {posargs} juju tests +[testenv:pylint] +basepython = python3 deps = - flake8 + pylint==2.6.0 + -rrequirements.txt +commands = + pylint -E n2vc --ignore=tests -[testenv:integration] -envdir = {toxworkdir}/py3 +[testenv:pylint-tests] +basepython = python3 +deps = + pylint==2.6.0 + -rrequirements.txt + -rtest-requirements.txt commands = - # These need to be installed in a specific order - pip install urllib3==1.22 - pip install pylxd - py.test --tb native -ra -v -s -n auto -k 'integration' -m 'not serial' {posargs} + pylint -E n2vc.tests -[testenv:serial] -# tests that can't be run in parallel -envdir = {toxworkdir}/py3 -commands = py.test --tb native -ra -v -s {posargs:-m 'serial'} +[testenv:black] +basepython = python3 +deps = + black +commands = + black --check --diff n2vc -[testenv:example] -envdir = {toxworkdir}/py3 -commands = python {posargs} +[testenv:flake8] +basepython = python3 +deps = + flake8 + -rrequirements.txt +commands = + flake8 n2vc [flake8] -exclude = juju/client/_* +# W503 is invalid PEP-8 +max-line-length = 100 +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 +commands = python3 setup.py --command-packages=stdeb.command bdist_deb