Migrate test run to ostestr
Instead of running tests with nosetests, this commit migrates tox.ini to use ostestr similar to other openstack projects. Using ostestr, as well testrepository, results in another useful feature where test results can be seen in convenient graphical representation. Additionally: * added oslo_debug_helper * extracted unit-like dependencies into external testenv, that way they are not installed for target where they are actually not required (like pep8) * removed testenv:docs because monasca does not come with sphinx documentation * removed testenv:genconfig because monasca is not compatible with supplying its entire configuration they way oslo-config-generator expects Change-Id: Ic5bb793847f7ab45731862f4208e94589421f490
This commit is contained in:
parent
5deaf63815
commit
ff0afc968b
@ -1,7 +1,7 @@
|
||||
[run]
|
||||
branch = True
|
||||
source = monasca
|
||||
omit = monasca/tests/*
|
||||
source = monasca_api
|
||||
omit = monasca_api/tests/*
|
||||
|
||||
[report]
|
||||
ignore_errors = True
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@
|
||||
docs/build/*
|
||||
dist
|
||||
build
|
||||
cover
|
||||
cover*
|
||||
.coverage
|
||||
*.egg
|
||||
*.egg-info
|
||||
|
@ -1,8 +1,9 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t . ./monasca_api/tests $LISTOPT $IDOPTION
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ $OS_TEST_PATH $LISTOPT $IDOPTION
|
||||
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
group_regex=monasca_api\.tests(?:\.|_)([^_]+)
|
@ -2,18 +2,16 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking<0.11,>=0.10.0
|
||||
hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0
|
||||
Babel>=2.3.4 # BSD
|
||||
coverage>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
flake8<2.6.0,>=2.5.4 # MIT
|
||||
pep8==1.5.7 # MIT
|
||||
httplib2>=0.7.5 # MIT
|
||||
mock>=2.0 # BSD
|
||||
funcsigs>=0.4;python_version=='2.7' or python_version=='2.6' # Apache-2.0
|
||||
mox>=0.5.3 # Apache-2.0
|
||||
nose # LGPL
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
os-testr>=0.8.0 # Apache-2.0
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
|
65
tox.ini
65
tox.ini
@ -1,40 +1,75 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
skipsdist = True
|
||||
envlist = py27,pep8
|
||||
minversion = 2.1
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_TEST_PATH=monasca_api/tests
|
||||
CLIENT_NAME=monasca-api
|
||||
passenv = http_proxy
|
||||
HTTP_PROXY
|
||||
https_proxy
|
||||
HTTPS_PROXY
|
||||
no_proxy
|
||||
NO_PROXY
|
||||
usedevelop = True
|
||||
install_command =
|
||||
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
whitelist_externals = find
|
||||
whitelist_externals = bash
|
||||
find
|
||||
rm
|
||||
commands =
|
||||
pip install influxdb==2.8.0
|
||||
pip install cassandra-driver>=2.1.4,!=3.6.0
|
||||
find . -type f -name "*.pyc" -delete
|
||||
python setup.py testr --testr-args='{posargs}'
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
deps = {[testenv:unit_deps]deps}
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
ostestr {posargs}
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
deps = {[testenv:unit_deps]deps}
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
ostestr {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
basepython = python2.7
|
||||
deps = {[testenv:unit_deps]deps}
|
||||
commands =
|
||||
python setup.py testr --coverage \
|
||||
--testr-args='^(?!.*test.*coverage).*$'
|
||||
{[testenv]commands}
|
||||
coverage erase
|
||||
python setup.py test --coverage --testr-args='{posargs}' --coverage-package-name=monasca_api
|
||||
coverage report
|
||||
|
||||
[testenv:debug]
|
||||
deps = {[testenv:unit_deps]deps}
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
oslo_debug_helper -t ./monasca_api/tests {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
commands =
|
||||
flake8 monasca_api
|
||||
|
||||
[testenv:genconfig]
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
# note(trebskit): this is just placeholder to wrap all common dependencies
|
||||
# needed to run tests, those dependencies won't likely
|
||||
# be needed for every possible -e here, so extracted them here
|
||||
[testenv:unit_deps]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
influxdb==2.8.0
|
||||
cassandra-driver>=2.1.4,!=3.6.0
|
||||
|
||||
[flake8]
|
||||
# TODO: ignored checks should be enabled in the future
|
||||
# H201 no 'except:' at least use 'except Exception:'
|
||||
|
Loading…
x
Reference in New Issue
Block a user