Tidy tox targets, fix coverage reporting

Misc fixes to bring tox targets back inline with general OpenStack
standards (py27 and py35 targets executed by default).

Deal with running 27 and 35 tests in succession.

This change also includes some fixes for coverage reporting; however
they are still currently broken due to mismatching module names
between nova-lxd and nova.virt.lxd.

Change-Id: If0079309a4c4b6b57fc6b5e6f0e947926b010f09
This commit is contained in:
James Page 2017-06-23 11:17:31 +01:00
parent f8daa3b38b
commit 6c66bd1f46
3 changed files with 36 additions and 22 deletions

View File

@ -1,8 +1,7 @@
[run]
branch = True
source = nova_lxd
omit = nova_lxd/tests/*
source = nova.virt.lxd
omit = nova/tests/*
[report]
ignore_errors = True
precision = 2

2
.gitignore vendored
View File

@ -53,3 +53,5 @@ ChangeLog
*~
.*.swp
.*sw?
cover

51
tox.ini
View File

@ -1,31 +1,45 @@
[tox]
minversion = 1.6
# Python 3 tests MUST run first, due to this bug:
# https://bugs.launchpad.net/testrepository/+bug/1229445
envlist = py3,py27,pep8
minversion = 2.0
envlist = py{35,27},pep8
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
EVENTLET_NO_GREENDNS=yes
PYTHONDONTWRITEBYTECODE=1
VIRTUAL_ENV={envdir}
EVENTLET_NO_GREENDNS=yes
PYTHONDONTWRITEBYTECODE=1
LANGUAGE=en_US
LC_ALL=en_US.utf-8
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-egit+https://github.com/openstack/nova.git#egg=nova
commands = ostestr {posargs}
whitelist_externals =
bash
find
rm
env
commands =
find . -type f -name "*.pyc" -delete
rm -Rf .testrepository/times.dbm
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OS_DEBUG GENERATE_HASHES
[testenv:py27]
commands = /bin/cp -r {toxinidir}/nova/virt/lxd/ {toxinidir}/.tox/py27/src/nova/nova/virt/
python setup.py testr --slowest --testr-args='{posargs}'
commands =
{[testenv]commands}
/bin/cp -r {toxinidir}/nova/virt/lxd/ {toxinidir}/.tox/py27/src/nova/nova/virt/
ostestr '{posargs}'
[testenv:py34]
commands = /bin/cp -r {toxinidir}/nova/virt/lxd/ {toxinidir}/.tox/py34/src/nova/nova/virt/
python setup.py testr --slowest --testr-args='{posargs}'
[testenv:py35]
commands =
{[testenv]commands}
/bin/cp -r {toxinidir}/nova/virt/lxd/ {toxinidir}/.tox/py35/src/nova/nova/virt/
ostestr '{posargs}'
[testenv:pep8]
basepython = python2.7
deps = {[testenv]deps}
commands = flake8 {toxinidir}/nova
[testenv:venv]
@ -34,12 +48,11 @@ commands = {posargs}
[testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage.
commands =
coverage erase
python setup.py testr --coverage --coverage-package-name=nova_lxd \
--testr-args='{posargs}'
coverage combine
coverage html --include='nova_lxd/*' -d covhtml -i
commands =
coverage erase
find . -type f -name "*.pyc" -delete
python setup.py testr --coverage --testr-args='{posargs}'
coverage report
[testenv:docs]
commands = python setup.py build_sphinx